Getting alpha/opacity of a View in Android

By : Justin

How can I get the alpha/opacity of a View after I've animated it?

My fadeIn() is below - fadeOut() is the same with the endpoints switched.

public void fadeIn(View view) {
    Animation animation = new AlphaAnimation(0.0f, 1.0f);
By : Justin


I would highly recommend you to define the animations in an XML-file. The API doesn't have support for getting a specific alpha.

You can still have in mind that the opacity that your view has, is the last one you've defined; in this case, (your fadeIn() method), your latest opacity value is the value you passed into the AlphaAnimation constructor.

By : Wroclai

This video can help you solving your question :)
By: admin