选中样式:R.drawable.bg_pay_checkbox
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<item
android:state_checked="false" >
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="1dp" />
<solid android:color="@color/white"/>
<stroke
android:color="#999999"
android:width="1px" />
<size android:width="17dp"
android:height="17dp"
/>
<padding android:top="4dp"
android:bottom="4dp"
android:left="2dp"
android:right="2dp"/>
</shape>
</item>
<item android:drawable="@drawable/ic_payment_agreement_select"
android:state_checked="true" />
</layer-list>
CheckBox选择样式
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bg_pay_checkbox"
android:state_checked="true" />
<item
android:state_checked="false" >
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="1dp" />
<solid android:color="@color/white"/>
<stroke
android:color="#999999"
android:width="1px" />
<size android:width="17dp"
android:height="17dp"
/>
<padding android:top="4dp"
android:bottom="4dp"
android:left="2dp"
android:right="2dp"/>
</shape>
</item>
</selector>
使用
<CheckBox
android:id="@+id/cbAgreementChoose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/selector_pay_check"
android:button="@null"
android:drawablePadding="@dimen/margin_middle"
android:text="我同意"
android:textColor="@color/black2"
android:textSize="@dimen/font_small" />
网友评论