Create fade In Animation and set duration - Android Animation

Android examples for Animation:Fade Animation

Description

Create fade In Animation and set duration

Demo Code


//package com.java2s;

import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

import android.view.animation.LinearInterpolator;

public class Main {
    public static Animation fadeIn(
            final android.view.animation.Animation.AnimationListener animationlistener) {
        final AlphaAnimation alphaanimation = new AlphaAnimation(0F, 1F);
        alphaanimation.setDuration(300L);
        alphaanimation.setInterpolator(new LinearInterpolator());
        alphaanimation.setAnimationListener(animationlistener);
        return alphaanimation;
    }/*from ww  w .j av a2s  . c  o m*/
}

Related Tutorials