最后样式为:
布局文件:
<RadioGroup
android:layout_centerVertical="true"
android:layout_marginLeft="100dp"
android:id="@+id/radioGroup2"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:checkedButton="@+id/radioButton2_1"
android:orientation="horizontal">
<RadioButton
android:id="@+id/radioButton2_1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:button="@null"
android:checked="false"
android:drawableLeft="@null"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="万"
android:background="@drawable/selector_448ced_ffffff_corners_lefttop_leftbottom_4"
android:textColor="@drawable/selector_color_448ced_ffffff"
android:textSize="13sp" />
<RadioButton
android:background="@drawable/selector_ffffff_448ced_corners_righttop_rightbottom_4"
android:textColor="@drawable/selector_color_448ced_ffffff"
android:id="@+id/radioButton2_2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:button="@null"
android:drawableLeft="@null"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="亿"
android:textSize="13sp" />
</RadioGroup>
selector_448ced_ffffff_corners_lefttop_leftbottom_4.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_solid_ffffff_corners_lefttop_leftbottom_4_1stroke448ced" android:state_checked="false" />
<item android:drawable="@drawable/shape_solid_448ced_corners_lefttop_leftbottom_4" android:state_checked="true"/>
</selector>
shape_solid_ffffff_corners_lefttop_leftbottom_4_1stroke448ced.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="#ffffff"/>
<corners
android:bottomLeftRadius="4dp"
android:topLeftRadius="4dp"/>
<stroke
android:width="1dp"
android:color="#448ced"/>
</shape>
shape_solid_448ced_corners_lefttop_leftbottom_4.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="#448ced"/>
<corners
android:bottomLeftRadius="4dp"
android:topLeftRadius="4dp"/>
</shape>
selector_color_448ced_ffffff.xml
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#448ced" android:state_checked="false" />
<item android:color="#ffffff" android:state_checked="true"/>
</selector>
selector_ffffff_448ced_corners_righttop_rightbottom_4.xml
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_solid_ffffff_corners_righttop_rightbottom_4_1stroke448ced" android:state_checked="false" />
<item android:drawable="@drawable/shape_solid_448ced_corners_righttop_rightbottom_4" android:state_checked="true"/>
</selector>
shape_solid_ffffff_corners_righttop_rightbottom_4_1stroke448ced.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="#ffffff"/>
<corners
android:bottomRightRadius="4dp"
android:topRightRadius="4dp"/>
<stroke
android:width="1dp"
android:color="#448ced"/>
</shape>
shape_solid_448ced_corners_righttop_rightbottom_4.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="#448ced"/>
<corners
android:bottomRightRadius="4dp"
android:topRightRadius="4dp"/>
</shape>