Java tutorial
//package com.java2s; //License from project: Apache License 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; 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; } }