Get the "out" animation to right for the ViewFlipper. - Android Animation

Android examples for Animation:Animation to Hide

Description

Get the "out" animation to right for the ViewFlipper.

Demo Code


//package com.java2s;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;

public class Main {
    private static final int FLIPPER_ANIMATION_DURATION = 350;
    private static Animation mOutToRightAnimation = null;

    /**/*from w w  w.java  2  s .c o m*/
     * Get the "out" animation to right for the ViewFlipper.
     * @return The animation.
     */
    public static Animation getOutToRightAnimation() {
        if (mOutToRightAnimation == null) {
            mOutToRightAnimation = new TranslateAnimation(
                    Animation.RELATIVE_TO_PARENT, 0.0f,
                    Animation.RELATIVE_TO_PARENT, +1.0f,
                    Animation.RELATIVE_TO_PARENT, 0.0f,
                    Animation.RELATIVE_TO_PARENT, 0.0f);

            mOutToRightAnimation.setDuration(FLIPPER_ANIMATION_DURATION);
            mOutToRightAnimation
                    .setInterpolator(new AccelerateInterpolator());
        }

        return mOutToRightAnimation;
    }
}

Related Tutorials