create Fade In Animation - Android Animation

Android examples for Animation:Fade Animation

Description

create Fade In 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 w  w.  jav a 2 s  .  c om*/
     * @return A fade in animation from 0% - 100% taking half a second
     */
    public static Animation createFadeInAnimation() {
        Animation animation = new AlphaAnimation(INVISIBLE, VISIBLE);
        animation.setDuration(HALF_A_SECOND);
        return animation;
    }
}

Related Tutorials