Java tutorial
//package com.java2s; import android.animation.ObjectAnimator; import android.view.View; public class Main { public static ObjectAnimator animateTranslateX(final View view, float initialX, float finalX, int duration, int delay) { ObjectAnimator animator = ObjectAnimator.ofFloat(view, "TranslationX", initialX, finalX); animator.setDuration(duration); if (delay > 0) animator.setStartDelay(delay); // go for it animator.start(); return animator; } }