Android examples for Animation:Animation to Hide
hide View with Animation
import android.animation.Animator; import android.support.v4.view.animation.FastOutSlowInInterpolator; import android.view.View; import android.view.ViewPropertyAnimator; import android.view.animation.Interpolator; public class Main { private static final Interpolator FAST_OUT_SLOW_IN_INTERPOLATOR = new FastOutSlowInInterpolator(); public static void hideView(final View view, int duration) { ViewPropertyAnimator slideOutAnimator = view.animate().translationX(0) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR).setDuration(duration); slideOutAnimator.setListener(new Animator.AnimatorListener() { @Override/*from www .ja v a 2 s . co m*/ public void onAnimationStart(Animator animator) { view.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animator animator) { } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); slideOutAnimator.start(); } }