Get the hide animation of the top bar. - Android Animation

Android examples for Animation:Animation to Hide

Description

Get the hide animation of the top bar.

Demo Code


//package com.java2s;

import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;

public class Main {
    private static final int BARS_ANIMATION_DURATION = 150;
    private static Animation mTopBarHideAnimation = null;

    /**/* w  ww. j  a  v  a  2 s. c o  m*/
     * Get the hide animation of the top bar.
     * @return The animation.
     */
    public static Animation getTopBarHideAnimation() {
        if (mTopBarHideAnimation == null) {
            mTopBarHideAnimation = new TranslateAnimation(
                    Animation.RELATIVE_TO_SELF, 0.0f,
                    Animation.RELATIVE_TO_SELF, 0.0f,
                    Animation.RELATIVE_TO_SELF, 0.0f,
                    Animation.RELATIVE_TO_SELF, -1.0f);

            mTopBarHideAnimation.setDuration(BARS_ANIMATION_DURATION);
        }

        return mTopBarHideAnimation;
    }
}

Related Tutorials