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.
Best Answer
Use AppCompatCheckBox and AppCompatRadioButton instead of CheckBox and RadioButton. Your xml will have :
Now for the java code : Create ColorStateList
To change the color programatically for AppCompatRadioButton or AppCompatCheckBox call setSupportButtonTintList.