get List Animation - Android android.view.animation

Android examples for android.view.animation:Animation

Description

get List Animation

Demo Code

import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;

public class Main{

    public static final int GAMES_SCALE_DURATION = 350;
    public static final int GAMES_ALPHA_DURATION = 800;
    public static Animation getListAnimation() {
        AnimationSet animationSet = new AnimationSet(false);
        ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f,
                0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setDuration(GAMES_SCALE_DURATION);
        AlphaAnimation alphaAnimation = (AlphaAnimation) getFadeInAnimation(GAMES_ALPHA_DURATION);
        animationSet.addAnimation(scaleAnimation);
        animationSet.addAnimation(alphaAnimation);
        animationSet.setFillAfter(false);
        return animationSet;
    }/*from   ww  w.j av a  2s.c  om*/
    private static Animation getFadeInAnimation(int duration) {
        AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
        alphaAnimation.setDuration(duration);
        return alphaAnimation;
    }
    public static Animation getFadeInAnimation() {
        return getFadeInAnimation(DURATION * 2);
    }

}

Related Tutorials