create Fadeout Animation - Android Animation

Android examples for Animation:Fade Animation

Description

create Fadeout Animation

Demo Code


//package com.java2s;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

public class Main {
    private static final int HALF_A_SECOND = 500;
    private static final float VISIBLE = 1.0f;
    private static final float INVISIBLE = 0.0f;

    /**/*from   w ww . j a  va 2s  . c  o m*/
     * @return A fade out animation from 100% - 0% taking half a second
     */
    public static Animation createFadeoutAnimation() {
        Animation fadeout = new AlphaAnimation(VISIBLE, INVISIBLE);
        fadeout.setDuration(HALF_A_SECOND);
        return fadeout;
    }
}

Related Tutorials