james
james

Reputation: 26271

Set drawable opacity

How can i set the opacity of a Drawable object?

Upvotes: 16

Views: 19311

Answers (2)

hector6872
hector6872

Reputation: 1336

0 means fully transparent, and 255 means fully opaque:

(drawable).getBackground().setAlpha(int alpha);

Upvotes: 0

Kevin Coppock
Kevin Coppock

Reputation: 134714

You can use Drawable's setAlpha() method. It takes an int from 0 to 255, 0 being fully transparent, and 255 being fully opaque.

See the developer reference here.

Upvotes: 30

Related Questions