简体   繁体   English

MobileFirst Android中的单选按钮组

[英]Radio button group in MobileFirst Android

I want to put two radio buttons (male and female) in my application. 我想在应用程序中放置两个单选按钮(男性和女性)。

I did so using radio buttons (not group) but the problem is: a button can not be unchecked also both can be checked at the same time 我这样做是使用单选按钮(不是组),但是问题是:不能取消选中一个按钮,也可以同时选中这两个按钮

RadioButton group is a group of three buttons and I only need two. RadioButton组是一组三个按钮,我只需要两个。 Is there a way they can be two? 有没有办法可以成为两个?

So any help? 有什么帮助吗?

Try this: 尝试这个:

<RadioGroup
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Male"/>
        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Female"/>
        </RadioGroup>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM