Skip to content
Advertisement

How can I change the drawable color of RadioButton’s background programmatically?

My radio buttons have background which is selector drawable.

And I want to change the color of state_checked=”true” item’s drawable programmatically.

The background of radiobutton :

JavaScript

checkbox_membertag_active :

JavaScript

and I tried in this way. I want to change the @color/white of active item to starColor which I pre-declared. But it’s still white color.

JavaScript

Advertisement

Answer

Try with ColorStatList like the Code below :

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement