package cn.bingoogolapple.bgabanner.transformer; import android.support.v4.view.ViewCompat; import android.view.View; /** * 作者:王浩 邮件:bingoogolapple@gmail.com * 创建时间:15/6/19 上午8:41 * 描述: */ public class AlphaPageTransformer extends BGAPageTransformer { private float mMinScale = 0.4f; public AlphaPageTransformer() { } public AlphaPageTransformer(float minScale) { setMinScale(minScale); } @Override public void handleInvisiblePage(View view, float position) { ViewCompat.setAlpha(view, 0); } @Override public void handleLeftPage(View view, float position) { ViewCompat.setAlpha(view, mMinScale + (1 - mMinScale) * (1 + position)); } @Override public void handleRightPage(View view, float position) { ViewCompat.setAlpha(view, mMinScale + (1 - mMinScale) * (1 - position)); } public void setMinScale(float minScale) { if (minScale >= 0.0f && minScale <= 1.0f) { mMinScale = minScale; } } }