RadioButton即单选框,是一种基础的UI控件。RadioGroup为我们提供了RadioButton单选按钮的容器,RadioButton通常放于RadioGroup容器中进行使用。RadioButton的选中状态,在xml文件中可以使用android:checked=""来进行设置,选中就设置为true,没选中就设置为false。
这里先贴上XML的代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/ll_sex"
android:layout_width="wrap_content"
a