mytechead

Android & Wordpress Help center

Android fadeout animation

To add fade out animation to an element, you can use AlphaAnimation provided by android animation class.

The code required goes like this-

Animation fadeOut = new AlphaAnimation(1, 0);  /./ the 1, 0 here notifies that we want the opacity to go from opaque (1) to transparent (0)
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setStartOffset(500); // Start fading out after 500 milli seconds
fadeOut.setDuration(1000); // Fadeout duration should be 1000 milli seconds

 

Now set this to an element say an image view –

myImageView.setAnimation(fadeOut);

and if you want to fadeout and hide the element completely the above line should be followed by –

 

myImageView.setVisibility(View.GONE);

and you are done!!

Advertisements

Single Post Navigation

2 thoughts on “Android fadeout animation

  1. I got this web page from my pal who informed me about this site and now
    this time I am visiting this web site and reading very informative content at this place.

  2. Hey just wanted to give you a quick heads
    up and let you know a few of the images aren’t loading correctly. I’m not
    sure why but I think its a linking issue. I’ve tried it in two different browsers and both show the same results.

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: