Java tutorial
//package com.java2s; import android.animation.ValueAnimator; import android.annotation.TargetApi; 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 getRiseElevationValue(final View targetView, int duration, final int mimElevation, final int maxElevation) { ValueAnimator addElevationValueAnim = ValueAnimator.ofInt(1); addElevationValueAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) @Override public void onAnimationUpdate(ValueAnimator animation) { float fraction = animation.getAnimatedFraction(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { targetView.setElevation((1 - fraction) * maxElevation + mimElevation); } } }); addElevationValueAnim.setDuration(duration); return addElevationValueAnim; } public static ValueAnimator getRiseElevationValue(final View targetView, int duration) { return getRiseElevationValue(targetView, duration, DEFUALT_MIN_ELEVATION, DEFUALT_DEC_ELEVATION); } }