<CheckBox
android:id="@+id/cbox_pay_way_zhifubao"
style="@style/shop_bag_cbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/x28"
android:checked="true"/>
<style name="shop_bag_cbox" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/bm_selector_shop_cbox</item>
</style>
<?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/bm_icon_circle"/>
<item android:state_checked="false" android:drawable="@drawable/bm_icon_circle_no"/>
<item android:drawable="@drawable/bm_icon_circle_no"/>
</selector>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkbox"
android:layout_centerInParent="true"
style="@style/custom_check_box"
android:checked="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<RadioButton
android:layout_marginTop="10dp"
android:layout_below="@id/checkbox"
android:layout_centerHorizontal="true"
style="@style/custom_check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
<style name="custom_check_box" parent="Base.Widget.AppCompat.CompoundButton.CheckBox">
<item name="android:button">@drawable/selector_check_box_style</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_unselected" android:state_checked="true" />
<item android:drawable="@drawable/ic_selected" android:state_checked="false" />
<item android:drawable="@drawable/ic_selected" />
</selector>
这个checkbox可以是选择和反选
而 radioButton只能是选择, 没有反选, 所以不常用啦