get List Animation - Android android.animation

Android examples for android.animation:Animation

Description

get List Animation

Demo Code


//package com.java2s;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.ScaleAnimation;

public class Main {
    public static final int GAMES_ALPHA_DURATION = 800;
    public static final int GAMES_SCALE_DURATION = 350;
    public static final int DURATION = 700;

    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 w w  w.  j  a v a  2  s .c o m

    public static Animation getFadeInAnimation() {
        return getFadeInAnimation(DURATION * 2);
    }

    private static Animation getFadeInAnimation(int duration) {
        AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
        alphaAnimation.setDuration(duration);
        return alphaAnimation;
    }
}

Related Tutorials