Back to project page AndroidImageSlider.
The source code is released under:
MIT License
If you think the Android project AndroidImageSlider listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.daimajia.slider.library.Transformers; // ww w. jav a 2s .co m import android.view.View; import com.nineoldandroids.view.ViewHelper; public class DepthPageTransformer extends BaseTransformer { private static final float MIN_SCALE = 0.75f; @Override protected void onTransform(View view, float position) { if (position <= 0f) { ViewHelper.setTranslationX(view,0f); ViewHelper.setScaleX(view,1f); ViewHelper.setScaleY(view,1f); } else if (position <= 1f) { final float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position)); ViewHelper.setAlpha(view,1-position); ViewHelper.setPivotY(view,0.5f * view.getHeight()); ViewHelper.setTranslationX(view,view.getWidth() * - position); ViewHelper.setScaleX(view,scaleFactor); ViewHelper.setScaleY(view,scaleFactor); } } @Override protected boolean isPagingEnabled() { return true; } }