转载:http://www.bangchui.org/read.php?tid=10861

1. xml中通过android:button="@drawable/check_box" 指定图片

 <CheckBox android:text="CheckBox" android:id="@+id/checkBox1"        android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:button="@drawable/check_box"     >


2. check_box定义在xml中

<?xml version="1.0" encoding="utf-8"?><!-- This is the rating bar drawable that is used to a show a filled star. --><selector xmlns:android="http://schemas.android.com/apk/res/android">      <item android:state_checked="false"          android:state_enabled="true"          android:drawable="@drawable/checkbox_off" />    <item android:state_checked="true"          android:state_enabled="true"          android:drawable="@drawable/checkbox_on" /> </selector>
3. 修改前后对比

更多相关文章

  1. Android使用xml自定义图片
  2. android 自定义输入框
  3. Android使用系统分享文件给微信,QQ指定的用户
  4. 【email】android邮件Email
  5. ContentProvider
  6. 切换选项卡
  7. CreateProcess error=2, 系统找不到指定的文件。
  8. android viewPage 判断是否到最后一页
  9. Android高手进阶教程(二十七)之---基于ViewFlipper实现的自定义

随机推荐

  1. Android(安卓)Material Design动画 Anima
  2. Android Studio Gradle多渠道打包(动态设
  3. Android 源码下载、编译以及编译自己的ap
  4. Android 重要知识学习整理
  5. Android热更新方案Robust——美团热更新(
  6. android 打电话的例子
  7. Android之JAVASe基础篇-面向对象-IO(九)
  8. android用户界面详尽教程实例
  9. Android - ScrollView嵌套ListView~使Lis
  10. Android的两个bugs