set Flicker Animation - Android Animation

Android examples for Animation:Animation Creation

Description

set Flicker Animation

Demo Code


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

public class Main {
    public static void setFlickerAnimation(View v) {
        final Animation animation = new AlphaAnimation(1, 0); 
        animation.setDuration(500); // duration - half a second
        animation.setInterpolator(new LinearInterpolator()); 
        animation.setRepeatCount(Animation.INFINITE); 
        animation.setRepeatMode(Animation.REVERSE); //
        v.setAnimation(animation);/*from  w  w  w .ja  v a 2s . co  m*/
    }
}

Related Tutorials