Android examples for Animation:Translate Animation
Animates the view by translating the view in the x direction by the specified x 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 translationXBy(final View pView, final float pValue, final int pDuration, final Runnable pEndAction) { if (AndroidUtils.isUIThread()) { pView.animate().setDuration(pDuration).translationXBy(pValue) .withEndAction(pEndAction); } else {/*w w w . j ava 2 s.com*/ pView.post(new Runnable() { public void run() { translationXBy(pView, pValue, pDuration, pEndAction); } }); } } }