Android examples for Animation:Translate Animation
Animates the view by translating the view in the y direction to 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 translationY(final View pView, final float pValue, final int pDuration, final Runnable pEndAction) { if (AndroidUtils.isUIThread()) { pView.animate().setDuration(pDuration).translationY(pValue) .withEndAction(pEndAction); } else {/*from w ww . ja va2 s . co m*/ pView.post(new Runnable() { public void run() { translationY(pView, pValue, pDuration, pEndAction); } }); } } }