Set Menu Animation - Android User Interface

Android examples for User Interface:Menu

Description

Set Menu Animation

Demo Code


import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.ImageView;
import android.widget.TextView;

public class Main{
    public static void SetMenuAnimation(final ImageView v, final int bg1,
            final int bg2) {
        v.setImageResource(bg1);//from   w ww  . ja v  a2s .c  o  m
        AlphaAnimation alphaanimation = new AlphaAnimation(0.8F, 1.0F);
        alphaanimation.setDuration(1000L);
        alphaanimation.setRepeatCount(-1);
        alphaanimation.setInterpolator(new AccelerateInterpolator());
        alphaanimation.setAnimationListener(new ImageViewAnimation(bg1,
                bg2, v));
        v.startAnimation(alphaanimation);
    }
}

Related Tutorials