Android examples for User Interface:View Fade
animate View Fade Out
import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ArgbEvaluator; import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.text.TextUtils; import android.view.View; import android.view.ViewPropertyAnimator; import android.view.animation.AccelerateInterpolator; import android.view.animation.LinearInterpolator; import android.widget.TextView; public class Main{ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public static void animFadeOut(final View view) { ViewPropertyAnimator viewPropertyAnimator = view.animate(); viewPropertyAnimator.alpha(0f);/*from w w w . j av a 2s.co m*/ viewPropertyAnimator.setDuration(300l); viewPropertyAnimator.start(); viewPropertyAnimator.setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.GONE); } }); } }