android:定制checkbox 图片

<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:drawable="@drawable/checkbox" android:state_checked="false"/>
    <item android:drawable="@drawable/checkboxselected" android:state_checked="true"/>
    <item android:drawable="@drawable/checkbox"/>    
</selector>

Make sure your checkbox is like this Use this to change checkbox image. android:button="@drawable/checkbox_selector"

 <CheckBox
 android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@drawable/checkbox_selector"
android:text="CheckBox"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/Black" />
博主设置当前文章不允许评论。

没有更多推荐了,返回首页