Create Alpha Animation with Animation Listener - Android Animation

Android examples for Animation:Alpha Fly Animation

Description

Create Alpha Animation with Animation Listener

Demo Code


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

public class Main {
    public static Animation getAplahaAnimation() {
        final Animation aplhaanimation = new AlphaAnimation(1.0f, 0.2f);
        aplhaanimation.setDuration(2000);
        aplhaanimation.setAnimationListener(new AnimationListener() {
            public void onAnimationEnd(Animation arg0) {
                aplhaanimation.setFillAfter(false);
            }//  w w  w.  j av a 2  s .c  om

            public void onAnimationRepeat(Animation arg0) {

            }

            public void onAnimationStart(Animation arg0) {

            }

        });
        return (aplhaanimation);
    }
}

Related Tutorials