在XML的Android禁用无线电集团 [英] Android disable radio group in xml
问题描述
在我的Android应用程序,我需要在XML布局禁用无线电集团。我搜索,但我发现只有通过亲语法不是XML布局。
In my android application, I need to disable radio group in xml layout. I searched, but I found only through pro-grammatically not in xml layout.
我的code是这里
<RadioGroup
android:id="@+id/menu1"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_x="170dp"
android:layout_y="100dp" >
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yes" />
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No" />
</RadioGroup>
我试过与Android:启用=假,但它不是由广电集团的支持。但是,在单选按钮的工作原理
I've tried with android:enabled="false" but it is not supported by Radio Group. But it works in RadioButton as
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="Yes" />
现在我的问题是,如果我RadioGroup中包含10个单选按钮,我想设置启用=假只为RadioGroup中,不是每一个人的单选按钮。那么,如何可以禁用整个RadioGroup中,而不是禁用单选按钮吗?
Now my question is If my RadioGroup contains 10 RadioButtons, I want to set enable=false only for the RadioGroup, not for every individual RadioButton. So how can I disable the entire RadioGroup instead of disabling RadioButtons?
我只需要在XML布局。在此先感谢
I need only in xml layout. Thanks in advance
推荐答案
使用以下的属性。
android:clickable="false"
这篇关于在XML的Android禁用无线电集团的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!