Android examples for Animation:Fade Animation
Fade in or fade out a given view.
//package com.java2s; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.view.View; public class Main { public static void animateViewSetVisible(final boolean visible, final View view) { view.setVisibility(View.VISIBLE); view.setAlpha(visible ? 0 : 1);//from w w w . ja va2 s.com view.animate().setDuration(300).alpha(visible ? 1 : 0) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { view.setVisibility(visible ? View.VISIBLE : View.GONE); } }); } }