1 定义显示效果,在res/drawable文件下新建xml文件 如mycheckbox.xml
<?xml version="1.0" encoding="utf-8"?><selectorxmlns:android="http://schemas.android.com/apk/res/android"><item android:state_window_focused="false" android:state_enabled="true" android:state_checked="true" android:drawable="@drawable/check1" /><item android:state_window_focused="false" android:state_enabled="true" android:state_checked="false" android:drawable="@drawable/check2" /><item android:state_enabled="true" android:state_checked="true" android:state_pressed="true" android:drawable="@drawable/check1" /><item android:state_enabled="true" android:state_checked="false" android:state_pressed="true" android:drawable="@drawable/check2" /><item android:state_focused="true" android:state_enabled="true" android:state_checked="true" android:drawable="@drawable/check1" /><item android:state_focused="true" android:state_enabled="true" android:state_checked="false" android:drawable="@drawable/check2" /><item android:state_enabled="true" android:state_checked="false" android:drawable="@drawable/check2" /><item android:state_enabled="true" android:state_checked="true" android:drawable="@drawable/check1" /></selector>


2 定义checkbox并在其中引用上面定义好的drawable
<CheckBox    android:id="@+id/Checked"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:focusable="false"   android:button="@drawable/mycheckbox"/>

更多相关文章

  1. NPM 和webpack 的基础使用
  2. 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程
  3. Android(安卓)自定义CheckBox 样式
  4. Android(安卓)命令行手动编译打包详解
  5. 2011.09.07(2)——— android 跨进程通信之隐式intent
  6. 2011.09.07(4)——— android 跨进程通信之content provider
  7. Ubuntu10.10下真机调试
  8. android 往sd卡中写入文件
  9. Android(安卓)建立文件夹、生成文件并写入文本文件内容

随机推荐

  1. OkHttp3.0 添加SSL证书信任
  2. 浅析安卓的启动过程
  3. android 学习笔记2——实现基本功能
  4. Android工程手动增加插件包方法
  5. Android消息机制(基于源码解析)
  6. android中使用URL Scheme方式启动app
  7. Android(安卓)Studio 中setOnClickListen
  8. Android系列之Message机制的灵活应用
  9. [原]Android有用代码片断(六)
  10. Android(安卓)EditText 自定义带删除按钮