RSS

Blink image animation in android

28 Jun

There are several, depending on what kind of flashing do you mean. You can use, for example, alpha animation and start it as your button first appears. And when the user clicks button, in your OnClickListener just do clearAnimation().

Example:

setContentView(R.layout.glow_layout);		
ImageView imageview = (ImageView)findViewById(R.id.imageView1);			
final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
animation.setDuration(500); // duration - half a second
animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely
animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in	    
imageview.startAnimation(animation);
Advertisements
 
Leave a comment

Posted by on June 28, 2013 in Android Source Code

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: