Marian Pavel
Marian Pavel

Reputation: 2886

Android convert Transparent color to drawable

Is there a way how can I set the buttonDrawable of a CheckBox to transparent ?

Setting it like this: setButtonDrawable(Color.TRANSPARENT); doesn't work. I don't remember if there was a solution converting a color as a Drawable and use it like this for example. What I've searched so far and I saw it worked is to set the Transparent Color from XML but I don't have one and I would like to do it programmatically.

Upvotes: 3

Views: 1089

Answers (2)

Nouran S. Ahmad
Nouran S. Ahmad

Reputation: 503

I tried this and it worked:

new ColorDrawable(Color.parseColor("#00ffffff"));

Upvotes: 1

Blackbelt
Blackbelt

Reputation: 157467

you can give new ColorDrawable(Color.TRANSPARENT) a try

Upvotes: 2

Related Questions