Get the "in" animation from right for the ViewFlipper. - Android Animation

Android examples for Animation:Animation to Show

Description

Get the "in" animation from 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 mInFromRightAnimation = null;

    /**/*from   ww w  . j a v  a 2  s . c  o  m*/
     * Get the "in" animation from right for the ViewFlipper.
     * @return The animation.
     */
    public static Animation getInFromRightAnimation() {
        if (mInFromRightAnimation == null) {
            mInFromRightAnimation = new TranslateAnimation(
                    Animation.RELATIVE_TO_PARENT, +1.0f,
                    Animation.RELATIVE_TO_PARENT, 0.0f,
                    Animation.RELATIVE_TO_PARENT, 0.0f,
                    Animation.RELATIVE_TO_PARENT, 0.0f);

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

        return mInFromRightAnimation;
    }
}

Related Tutorials