自定义checkbox样式
2015-09-08 14:22
531 查看
首先在drawable文件夹中添加drawable文件checkbox_style.xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/checkbox_pressed" android:state_checked="true"/> <item android:drawable="@drawable/checkbox_normal" android:state_checked="false"/> <item android:drawable="@drawable/checkbox_normal"/> </selector>
在values文件夹下的styles.xml文件中添加CustomCheckboxTheme样式
<style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox"> <item name="android:button">@drawable/checkbox_style</item> </style>
在布局文件中使用CustomCheckboxTheme样式。
<CheckBox android:id="@+id/select_all" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/CustomCheckboxTheme" />
相关文章推荐
- jQuery根据ID获取input、checkbox、radio、select的示例
- jquery实现的代替传统checkbox样式插件
- asp.net动态产生checkbox(数据源为DB或内存集合)
- asp.net gridview中用checkbox全选的几种实现的区别
- asp.net treeview checkbox 相关问题
- IE中checkbox在刷新后初始化的问题
- 浅谈checkbox的一些操作(实战经验)
- asp.C#实现图片文件与base64string编码解码
- 多个datatable共存造成多个表格的checkbox都被选中
- javascript使用shift+click实现选择和反选checkbox的方法
- JS选中checkbox后获取table内一行TD所有数据的方法
- 用Javascript读取CheckBox数组的值的代码(兼容IE与firefox)
- javascript获取checkbox复选框获取选中的选项
- 关于树形菜单 Checkbox的全选
- 利用JavaScript更改input中radio和checkbox样式
- 原生js操作checkbox用document.getElementById实现
- 让checkbox不选中即将选中的checkbox不选中
- jQuery实现checkbox全选的方法
- jquery判断至少有一个checkbox被选中的方法
- jquery无法设置checkbox选中即没有变成选中状态