RadioButton
- 常用属性
- 自定义样式
- 监听事件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/rb_1"
android:text="深圳"
android:textSize="30sp"
android:textColor="#20281f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<RadioButton
android:id="@+id/rb_2"
android:text="上海"
android:textSize="30sp"
android:textColor="#20281f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/rb_1"/>
<RadioButton
android:id="@+id/rb_3"
android:text="北京"
android:textSize="30sp"
android:textColor="#20281f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/rb_2"/>
<RadioButton
android:id="@+id/rb_4"
android:text="广州"
android:textSize="30sp"
android:textColor="#20281f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/rb_3"/>
</RadioGroup>
</RelativeLayout>