Android examples for Animation:Animation to Show
get Show 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 getShowAlphaAnimation(long durationMillis, AnimationListener animationListener) { return getAlphaAnimation(0.0f, 1.0f, durationMillis, animationListener);//from ww w . j av a 2s. co m } public static AlphaAnimation getShowAlphaAnimation(long durationMillis) { return getAlphaAnimation(0.0f, 1.0f, durationMillis, null); } public static AlphaAnimation getShowAlphaAnimation( AnimationListener animationListener) { return getAlphaAnimation(0.0f, 1.0f, DEFAULT_ANIMATION_DURATION, animationListener); } public static AlphaAnimation getShowAlphaAnimation() { return getAlphaAnimation(0.0f, 1.0f, DEFAULT_ANIMATION_DURATION, null); } public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis, AnimationListener animationListener) { AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha); 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); } }