Android & Wordpress Help center

Archive for the month “September, 2012”

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 –


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



and you are done!!


Post Navigation