android中设置CheckBox的样式
来源:互联网 发布:华为网盘网络连接失败 编辑:程序博客网 时间:2024/06/08 05:53
1、设置CheckBox选中/不选中,按下/不按下状态的样式
<1>、在drawable中配置checkbox.xml
<?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:state_pressed="true" android:drawable="@drawable/focused" ;/> <item android:state_checked="false" android:state_pressed="true" android:drawable="@drawable/normal" ;/> <item android:state_checked="false" android:drawable="@drawable/normal" ;/> <item android:state_checked="true" android:drawable="@drawable/focused" ;/> </selector>
<2>、在res/values/styles.xml文件中添加MyCheckBox名称的Style
<style name="MyCheckBox"> <item name="android:button">@drawable/checkbox</item> </style>
<3>、在布局文件中设置CheckBox的style属性,如:
<CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/MyCheckBox"/>
2、当CheckBox作为ListView中ListItem的子组件时,ChekBox要有下面三个配置
android:focusable="false"
因为checkbox的点击事件优先级比listview的高,所以要在checkbox中添加android:focusable="false",使得checkbox初始的时候没有获取焦点。
- android中设置CheckBox的样式
- Android中checkbox控件的自定义样式设置
- android checkbox设置自定义的样式
- android代码中修改Checkbox的样式
- CSS3设置checkbox的样式
- 设置input 的 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自定义样式
- PHP学习笔记三:PHP数组学习小结
- SystemParametersinfo
- WIZnet开源硬件项目(部分)
- Android入门第三篇之RelativeLayout、FrameLayout .
- java.lang.IllegalArgumentException: Document base
- android中设置CheckBox的样式
- 开源数据挖掘工具比较
- txt文件导入到mysql中
- Android入门第二篇之LinearLayout、AbsoluteLayout .
- 把Tengine改回NGINX,又能用Tengine的一些特性
- Android入门第一篇 .
- sed命令详解
- YII+DWZ,制作了DwzActiveForm,用于自动把Yii的rules与dwz已整合的validate结合
- 为什么要对视频进行压缩