安卓---RedioButton(单选按钮)、CheckBox(复选按钮)

<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:checkedButton="@+id/rb2"
>
<RadioButton
android:id="@+id/rb1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="西瓜"
android:textColor="#ff0000"
>
</RadioButton>
<RadioButton
android:id="@+id/rb2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="香蕉"
android:textColor="#ff0000"
>
</RadioButton>
</RadioGroup>

<CheckBox
android:checked="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="荔枝"
></CheckBox>
<CheckBox
android:checked="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="车厘子"
>

</CheckBox>

原文地址:https://www.cnblogs.com/www123----/p/6874755.html