Android examples for Animation:Alpha Fly Animation
get Alpha Animation
//package com.java2s; import android.view.animation.AlphaAnimation; import android.view.animation.Animation.AnimationListener; public class Main { public static final long DEFAULT_ANIMATION_DURATION = 1000; public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis, AnimationListener animationListener) { AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha);//from www . j a va2s .c o m alphaAnimation.setDuration(durationMillis); if (animationListener != null) { alphaAnimation.setAnimationListener(animationListener); } return alphaAnimation; } public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis) { return getAlphaAnimation(fromAlpha, toAlpha, durationMillis, null); } public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, AnimationListener animationListener) { return getAlphaAnimation(fromAlpha, toAlpha, DEFAULT_ANIMATION_DURATION, animationListener); } public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha) { return getAlphaAnimation(fromAlpha, toAlpha, DEFAULT_ANIMATION_DURATION, null); } }