Only one radio button selected at a time(一次只选择一个单选按钮)
问题描述
我在一个单选组中有两个单选按钮.我还有 2 个 androd:button checkbox- 用于取消选择单选按钮时,以及 checkbox_v 用于用户选择复选框时.我还实现了一个方法 onRadioButtonClick
以确保只有一个单选按钮具有 drawable:checkbox 而另一个具有 checkbox_v .我怎样才能实现 onRadioClick 来做到这一点?有什么想法吗?
I have two radio button in a radio group. I also have 2 androd:button checkbox- for when the radio button is deselected and checkbox_v for when he user selects the checkbox. I also implemnted that a method onRadioButtonClick
in order to make sure that only one radio button had drawable:checkbox and the other has checkbox_v . How can I implemnt onRadioClick to do this? any idea?
主xml
Drawabe- button_radio
Drawabe- button_radio
推荐答案
如果他们在一个radiogroup中,一次只能选择一个.如果您希望两者都能够被选中,请将它们从无线电组中删除.
If they are in a radiogroup, only one can be selected at a time. If you want both to be able to be selected, remove them from the radiogroup.
这篇关于一次只选择一个单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!