<RadioGroup
android:id="@+id/rg"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="50px"
android:orientation="horizontal">
<RadioButton
android:id="@+id/ra1"
android:checked="true"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/selector1"
/>
<RadioButton
android:id="@+id/ra2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/selector2"
/>
<RadioButton
android:id="@+id/ra3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/selector3"
/>
<RadioButton
android:id="@+id/ra4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/selector4"
/>
<RadioButton
android:id="@+id/ra5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/selector5"
/>
android:id="@+id/rg"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="50px"
android:orientation="horizontal">
<RadioButton
android:id="@+id/ra1"
android:checked="true"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/selector1"
/>
<RadioButton
android:id="@+id/ra2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/selector2"
/>
<RadioButton
android:id="@+id/ra3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/selector3"
/>
<RadioButton
android:id="@+id/ra4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/selector4"
/>
<RadioButton
android:id="@+id/ra5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/selector5"
/>
</RadioGroup>
selector1 其他都一样 s1 s 是图片
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@drawable/s1"></item>
<item android:state_checked="false" android:drawable="@drawable/s"></item>
<item android:drawable="@drawable/s1"></item>
</selector>