转载: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. 修改前后对比
分享到:
相关推荐
android CheckBox的使用简单实例。
简单实现自定义checkbox控件四种选择状态的图片样式
android checkbox 的isChecked属性
拥有三种状态纯Material风格的Android Checkbox控件
Android checkbox 实现单选,代码较少,布局简单
android checkbox全选反选
Android 带有切换动画的CheckBox
Android CheckBox与监听Demo源码.rar
Checkbox多选全选
<item name="android:button">@drawable/selector</item>//这个selector.xml中就是对应不同状态的CheckBox的背景图片 3:在selector.xml <selector xmlns:android=...
CircleCheckBox Screenshot: Attrs attr format ...CircleCheckBox is available in the MavenCentral, so getting it as simple as adding it as a ...checkBox.setListener(new CircleCheckBox.On
最近公司需求做个员工报餐界面用到多个CheckBox 行列
Android中Selsetor选中时改变CheckBox背景,在开发中非常常用,我们通常会用到单选框,多选框,在实际项目中,默认的颜色不会满足我们的要求,所以,我们需要自己设置,这是我写的一个例子希望能和大家交流学习
博客地址:http://blog.csdn.net/csdnyuandaimaxuexi/article/details/48211573 Android 基本控件CheckBox学习
本demo实现功能为:Expandablelistview子项checkBox先获取已选择状态,在次过程中可修改子项选择,最终提交选择子类的项,并打印相关数据
CheckBox是Android中用的比较多的一个控件,不过它自带的button样式比较丑,通常都会替换成本地的资源图片。使用本地资源图片很简单,设置android:button属性为一个自定义的包含selector的drawable文件即可。 例如...
适用于初步学习Android移动开发,学习Android的CheckBox控件。里边也有相关Toast的简单应用。
原始的Android CheckBox 控件难看,而且占据的位置较大,给开发者带来不便。
Android完美解决ListView复用导致的Checkbox状态混乱问题,具体见博客 http://www.jianshu.com/p/744dcca03a99
这是我自己写的android listview里面使用checkbox的demo