package com.sxjs.common.widget.autoscrollviewpager.transformer; import android.support.v4.view.ViewCompat; import android.view.View; /** * 作者:王浩 邮件:bingoogolapple@gmail.com * 创建时间:15/6/19 上午8:41 * 描述: */ public class FlipPageTransformer extends BGAPageTransformer { private static final float ROTATION = 180.0f; @Override public void handleInvisiblePage(View view, float position) { } @Override public void handleLeftPage(View view, float position) { ViewCompat.setTranslationX(view, -view.getWidth() * position); float rotation = (ROTATION * position); ViewCompat.setRotationY(view, rotation); if (position > -0.5) { view.setVisibility(View.VISIBLE); } else { view.setVisibility(View.INVISIBLE); } } @Override public void handleRightPage(View view, float position) { ViewCompat.setTranslationX(view, -view.getWidth() * position); float rotation = (ROTATION * position); ViewCompat.setRotationY(view, rotation); if (position < 0.5) { view.setVisibility(View.VISIBLE); } else { view.setVisibility(View.INVISIBLE); } } }