[英]Android: Check radio button by its position in the radio group
I got the position of a radio in a radio group by using indexOfChild.我通过使用 indexOfChild 获得了无线电组中无线电的位置。 How can I use this index to check the radio that has this particular index?
如何使用此索引来检查具有此特定索引的收音机?
尝试这个
radioGroup.check(((RadioButton)radioGroup.getChildAt(index)).getId())
for(i in listCategory.indices){
if((categoryRadioGroup[i] as RadioButton).isChecked)
Toast.makeText(myContext, "$i", Toast.LENGTH_SHORT).show()
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.