Amit Desale Amit Desale - 11 months ago 85
Android Question

Android: Change the color of RadioButtons and checkboxes programmatically

I created

RadioButton
and
CheckBox
in
LinearLayout
programatically. But, now I want to change radio button's color and check boxes's color. I use

RadioButton.setHighlightColor(Color.parseColor("#0c83bd"));


checkbox.setHighlightColor(Color.parseColor("#0c83bd"));


But it didn't work.

Answer Source

Try this

AppCompatRadioButton newRadioButton = new AppCompatRadioButton(this);
AppCompatCheckBox newCheckBox = new AppCompatCheckBox(this);

Insted of

RadioGroup newRadioButton = new RadioGroup(this);
CheckBox newCheckBox = new CheckBox(this);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download