Android禁用xml中的无线电组

Android禁用xml中的无线电组,第1张

概述在我的 Android应用程序中,我需要在xml布局中禁用无线电组.我搜索过,但我发现只能通过编程方式而不是xml布局. 我的代码在这里 <RadioGroup android:id="@+id/menu1" android:layout_width="80dp" android:layout_height="wrap_content" 在我的 Android应用程序中,我需要在xml布局中禁用无线电组.我搜索过,但我发现只能通过编程方式而不是xml布局.

我的代码在这里

<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:enabled =“false”但是Radio Group不支持它.但它在Radiobutton中起作用

<Radiobutton            androID:ID="@+ID/radiobutton1"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:enabled="false"            androID:text="Yes" />

现在我的问题是如果我的RadioGroup包含10个Radiobuttons,我想仅为RadioGroup设置enable = false,而不是为每个单独的Radiobutton设置.那么如何禁用整个RadioGroup而不是禁用Radiobuttons?

我只需要在xml布局中.提前致谢

解决方法 使用以下属性

androID:clickable="false"
总结

以上是内存溢出为你收集整理的Android禁用xml中的无线电组全部内容,希望文章能够帮你解决Android禁用xml中的无线电组所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1122048.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存