Android RadioButton控件

 

RadioButton   单选按钮  

 

常用属性:

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>

 

posted @ 2019-05-15 15:10  chy_18883701161  阅读(1001)  评论(0编辑  收藏  举报