单选按钮不会切换其状态 [英] Radio Button does not toggle its state
问题描述
我在布局中添加了一个RadioButton.
I add a RadioButton in my layout.
开始时未选中.当我单击它时,它变为选中状态(如模拟器中所示).但是当我再次单击它时,它不会再次取消选中吗?
It is unchecked to begin with. And when I click on it , it becomes checked (as shown in emulator). But when when i click on it again, it does not become unchecked again?
<RadioButton android:checked="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/option1"/>
推荐答案
如果仅使用一个单选框进行打开和关闭检查,也许应该使用复选框或切换按钮.
If you are only using one radio box for checking on and off, maybe you should use checkbox or toggle button instead.
http://developer.android.com/resources/tutorials/views/hello-formstuff.html
向下滚动并查看复选框和切换按钮.
Scroll down and see checkbox and toggle button.
使用收音机时,通常有一个以上,并在它们之间进行选择.就像轻松,中等,困难一样.
When using radios you usually have more than one and choose between them. Like easy, medium, hard.
这篇关于单选按钮不会切换其状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!