RadioButton   单选按钮  

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

 

常用属性:

text  文本

checked=“true”  默认选中

 

一组互斥的单选按钮要放在RadioGroup中。RadioGroup常用属性:

orientation  该组单选按钮的排列方向。

 

示例:

 <RadioGroup
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/gender"
            android:orientation="horizontal">

            <RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/male"
                android:text="男"/>
            <RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/female"
                android:text="女"/>

</RadioGroup>

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄