Android examples for android.view.animation:Translate Animation
get Drop Elevation Value
import android.animation.ValueAnimator; import android.os.Build; import android.view.View; public class Main { private static final int DEFUALT_MIN_ELEVATION = 1; private static final int DEFUALT_DEC_ELEVATION = 20; public static ValueAnimator getDropElevationValue(final View targetView, int duration) { return getDropElevationValue(targetView, duration, DEFUALT_MIN_ELEVATION, DEFUALT_DEC_ELEVATION); }//from w w w .ja v a 2 s . c om public static ValueAnimator getDropElevationValue(final View targetView, int duration, final int mimElevation, final int decElevation) { ValueAnimator decElevationValueAnim = ValueAnimator.ofInt(1); decElevationValueAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float fraction = animation.getAnimatedFraction(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { targetView.setElevation(fraction * decElevation + mimElevation); } } }); decElevationValueAnim.setDuration(duration); return decElevationValueAnim; } }