Animation to close Menu - Android android.view.animation

Android examples for android.view.animation:Animation

Description

Animation to close Menu

Demo Code

import android.view.animation.Animation;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.RelativeLayout;

public class Main{

    public static void closeMenu(RelativeLayout rl, int startOffset) {
 
        for (int i = 0; i < rl.getChildCount(); i++) {
            rl.getChildAt(i).setEnabled(false);
        }/*from  w  ww. java2  s  . c  o  m*/
        RotateAnimation animation = new RotateAnimation(0, -180,
                RotateAnimation.RELATIVE_TO_SELF, 0.5f,
                RotateAnimation.RELATIVE_TO_SELF, 1);
        animation.setDuration(500);
        animation.setFillAfter(true);
        animation.setStartOffset(startOffset);
        animation.setAnimationListener(new MyAnimationListener());
        rl.startAnimation(animation);

    }

}

Related Tutorials