Java tutorial
//package com.java2s; //License from project: LGPL import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.view.View; public class Main { public static void animHide(final View v) { animHide(v, 300, v.getAlpha(), 0, true); } public static void animHide(final View v, int duration, float from, float to, final boolean gone) { v.clearAnimation(); ObjectAnimator anim = ObjectAnimator.ofFloat(v, "alpha", from, to).setDuration(duration); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); if (gone) { v.setVisibility(View.GONE); } } }); anim.start(); } }