Android: Change the color of RadioButtons and checkboxes programmatically

前端 未结 6 1230
轮回少年
轮回少年 2020-12-15 08:11

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

6条回答
  •  孤街浪徒
    2020-12-15 08:41

    Try this

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

    Insted of

    RadioGroup newRadioButton = new RadioGroup(this);
    CheckBox newCheckBox = new CheckBox(this);
    

提交回复
热议问题