Set selected index of an Android RadioGroup

前端 未结 7 1067
予麋鹿
予麋鹿 2021-02-01 11:52

Is there a way to set the selected index of a RadioGroup in android, other than looping through the child radiobuttons and selecting checking the radio button at the selected in

7条回答
  •  终归单人心
    2021-02-01 12:19

    you can do findViewById from the radio group .

    ((RadioButton)my_radio_group.findViewById(R.id.radiobtn_veg)).setChecked(true);`
    

提交回复
热议问题