Create flash effect Animation - Android Animation

Android examples for Animation:Animation Creation

Description

Create flash effect Animation

Demo Code


//package com.java2s;

import android.view.animation.AlphaAnimation;

import android.view.animation.AnimationSet;

public class Main {
    public static AnimationSet flash(
            final android.view.animation.Animation.AnimationListener animationlistener) {
        final AnimationSet animationset = new AnimationSet(true);
        final AlphaAnimation alphaanimation = new AlphaAnimation(0F, 1F);
        alphaanimation.setStartOffset(500L);
        alphaanimation.setDuration(100L);
        animationset.addAnimation(alphaanimation);
        final AlphaAnimation alphaanimation1 = new AlphaAnimation(1F, 0F);
        alphaanimation1.setDuration(100L);
        alphaanimation1.setStartOffset(1200L);
        animationset.addAnimation(alphaanimation1);
        animationset.setAnimationListener(animationlistener);
        return animationset;
    }/*from   w  w w  . ja  v  a2 s. c  o  m*/
}

Related Tutorials