Radio buttons and checkboxes are often seen in practice, and are now simply combed down.
First, we drag the radio button radiogroup and check box checkbox into the tool,
XML corresponding to the source code:
<?xml version= "1.0" encoding= "Utf-8"?>
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:orientation= "Vertical" >
<radiobutton
Android:id= "@+id/rightbutton"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "to"/>
<radiobutton
Android:id= "@+id/falsebutton"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "Wrong"/>
<checkbox
Android:id= "@+id/run_checkbox"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "Running"/>
<checkbox
Android:id= "@+id/read_checkbox"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "reading"/>
<button
Android:id= "@+id/button1"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "Settings"/>
</LinearLayout>
We modified the next RadioButton part of the code to:
<radiogroup
Android:id= "@+id/judge"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content" >
<radiobutton
Android:id= "@+id/rightbutton"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:checked= "true"
android:text= "to"/>
<radiobutton
Android:id= "@+id/falsebutton"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "Wrong"/>
</RadioGroup>
The effect is as follows:
3.Android radio button radiogroup and check box checkbox learning