Android examples for android.view.animation:Fade Animation
Animation to cross fade
import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.view.View; public class Main{ public static void crossfade(final View view_to_disappear, View view_to_show, int time) { view_to_show.setAlpha(0f);/*from www.j a v a 2 s . co m*/ view_to_show.setVisibility(View.VISIBLE); view_to_show.animate().alpha(1f).setDuration(time) .setListener(null); view_to_disappear.animate().alpha(0f).setDuration(time) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { view_to_disappear.setVisibility(View.GONE); } }); } }