Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android convert Transparent color to drawable

Tags:

android

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.

like image 418
Marian Pavel Avatar asked Feb 03 '26 19:02

Marian Pavel


2 Answers

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

like image 87
Blackbelt Avatar answered Feb 06 '26 08:02

Blackbelt


I tried this and it worked:

new ColorDrawable(Color.parseColor("#00ffffff"));
like image 43
Nouran S. Ahmad Avatar answered Feb 06 '26 07:02

Nouran S. Ahmad