Android中自定义checkbox样式
来源:互联网 发布:剑三花太捏脸数据 编辑:程序博客网 时间:2024/05/22 22:29
文章来自:http://blog.csdn.net/zuolongsnail/article/details/7106586
1.首先在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>
- <style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
- <item name="android:button">@drawable/checkbox_style</item>
- </style>
- <CheckBox
- android:id="@+id/select_all"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- style="@style/CustomCheckboxTheme" />
使用到的图片资源
checkbox_normal.png
checkbox_pressed.png
另:一个style.xml文件内可以定义多个<style></style>元素,在布局或者View中饮用的时候通过style="@style/[STYLE_NAME]" 引用。选择器同理
0 0
- Android中自定义checkbox样式
- Android中自定义checkbox样式
- android中checkbox自定义样式
- Android中自定义checkbox样式
- Android中自定义checkbox样式
- Android中自定义CheckBox样式
- Android中自定义CheckBox样式
- Android中自定义checkbox样式
- Android中自定义checkbox样式
- Android中自定义checkbox样式
- Android中自定义checkbox样式
- android中checkbox自定义样式
- Android中自定义checkbox样式
- Android中自定义checkbox样式
- Android中自定义checkbox样式
- android中CheckBox自定义样式
- Android中自定义checkbox样式
- Android中自定义checkbox样式
- Linux的lshw命令
- ios多线程操作(六)—— GCD全局队列与主队列
- Hibernate环境配置
- Android日历控件,还未实现点击日期改变背景色但可获取日期
- Code Forces 645A Amity Assessment
- Android中自定义checkbox样式
- leetcode 65. Valid Number
- HDU 5421 Victor and String
- linux 用户环境变量介绍
- ios多线程操作(七)—— GCD延迟操作与一次性代码
- 五步搞定Android开发环境部署——非常详细的Android开发环境搭建教程
- ios多线程操作(八)—— GCD调度组
- 小明传球
- 二进制原码,反码以及补码实战