androidcodehunter
androidcodehunter

Reputation: 21937

How to set 20% alpha value for Android Imagebutton?

I have a problem in using alpha value. I know how to set alpha value for background but I don't know how to set 20% alpha value for ImageButton.

imageButton.setAlpha(?)

Can anyone give me full details tutorial on this topic by which I can understand this topic better?

Upvotes: 7

Views: 6294

Answers (1)

Andy Res
Andy Res

Reputation: 16043

You don't need a tutorial for this, just read the javadoc of the method, which says:

setAlpha() - Sets the opacity of the view. This is a value from 0 to 1, where 0 means the view is completely transparent and 1 means the view is completely opaque.

20% transparent then would mean a value of 0.2.

Upvotes: 8

Related Questions