Android中如何修改CheckBox的颜色

多于话咱就不说了 直接上代码

布局中的代码

<CheckBox   android:id="@+id/cbMember"  android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:paddingLeft="8dp"   android:button="@drawable/checkbox_ic_style"   android:text="会员"    android:textColor="@color/colorAccent"    android:textSize="24dp" />

checkbox_ic_style.xml

<?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/ic_checkbox_selecte"        />    <item        android:state_checked="false"        android:drawable="@drawable/ic_checkbox_unselecte"        /></selector>

ic_checkbox_selecte.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"    android:width="30dp"    android:height="30dp"    android:viewportWidth="3000"    android:viewportHeight="3000">  <path      android:pathData="M372,2959c-121,-23 -235,-112 -293,-226l-34,-67 0,-1165 0,-1166 34,-67c59,-118 171,-203 301,-228 72,-14 2168,-14 2240,0 165,31 296,156 335,321 22,95 22,2182 0,2277 -20,85 -48,135 -109,200 -59,63 -137,106 -221,121 -71,13 -2186,13 -2253,0zM1293,2126c18,-8 263,-246 575,-558l542,-544 0,-46c0,-82 -67,-134 -142,-109 -23,8 -184,162 -528,506l-495,495 -240,-240 -241,-240 -46,0c-39,0 -52,5 -77,31 -35,35 -42,90 -17,137 24,46 558,570 586,575 44,8 50,7 83,-7z"      android:fillColor="#451507"      android:strokeColor="#451507"/></vector>

ic_checkbox_unselecte.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"    android:width="30dp"    android:height="30dp"    android:viewportWidth="3000"    android:viewportHeight="3000">  <path      android:pathData="M372,2959c-121,-23 -235,-112 -293,-226l-34,-67 0,-1165 0,-1166 34,-67c59,-118 171,-203 301,-228 72,-14 2168,-14 2240,0 165,31 296,156 335,321 22,95 22,2182 0,2277 -20,85 -48,135 -109,200 -59,63 -137,106 -221,121 -71,13 -2186,13 -2253,0zM2650,2734c43,-25 61,-42 83,-84l27,-52 0,-1094c0,-967 -2,-1099 -16,-1132 -19,-47 -58,-88 -107,-113 -36,-19 -69,-19 -1133,-19 -1198,0 -1133,-3 -1198,58 -16,15 -37,45 -47,67 -18,38 -19,91 -19,1136l0,1095 26,52c28,57 86,99 153,113 20,4 518,6 1106,5l1070,-1 55,-31z"      android:fillColor="#451507"      android:strokeColor="#451507"/></vector>

更多相关文章

  1. Android写文件到SDCard的一般过程和代码
  2. 指定Toast显示时长
  3. Android(安卓)小代码集
  4. android仿UC墨迹天气左右拖动效果
  5. Android应用程序启动过程源代码分析(4)
  6. Error:(19, 0) Gradle DSL method not found: 'android()' Possi
  7. Android应用程序启动过程源代码分析(3)
  8. MultiDex 遇到的大坑
  9. Android应用程序启动过程源代码分析(2)

随机推荐

  1. 制作Android Root Ramdisk
  2. Android中的AnimationSet使用
  3. Android 安装路径问题 -- 导致无法启动模
  4. Failed to fetch URL https://dl-ssl.goo
  5. Android 添加图片水印(图片+文字)
  6. Android 根据Video绝对路径获取其缩略图
  7. 浅析:Pulltorefresh使用中碰到的问题
  8. Android的平台架构
  9. INSTALL_FAILED_CONFLICTING_PROVIDER 安
  10. Android中使用全屏