Android examples for android.view.animation:ObjectAnimator
create Transition from ObjectAnimator
import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.view.View; public class Main { public static Animator createXTransition(View view, boolean enter) { ObjectAnimator x;/*from w w w .ja v a 2 s .c o m*/ ObjectAnimator y; if (enter) { x = ObjectAnimator.ofFloat(view, "translationX", 1f, 0f); y = ObjectAnimator.ofFloat(view, "translationY", 1f, 0f); } else { x = ObjectAnimator.ofFloat(view, "translationX", 0f, -1f); y = ObjectAnimator.ofFloat(view, "translationY", 0f, -1f); } AnimatorSet set = new AnimatorSet(); set.playTogether(x, y); return set; } }