Android examples for Animation:Translate Animation
Animates the view by translating the view in the y direction by the specified y value using the given duration.
import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; public class Main{ public static void translationYBy(final View pView, final float pValue, final int pDuration, final Runnable pEndAction) { if (AndroidUtils.isUIThread()) { pView.animate().setDuration(pDuration).translationYBy(pValue) .withEndAction(pEndAction); } else {// w w w . j a v a 2 s . c om pView.post(new Runnable() { public void run() { translationYBy(pView, pValue, pDuration, pEndAction); } }); } } }