android RadioButton注意事项
来源:互联网 发布:阿里云备案幕布多少钱 编辑:程序博客网 时间:2024/05/22 04:56
用RadioButton做个小控件,用selector作了个背景,selector里item的声明竟然要有顺序,好恶心。所以以后遇到定义的selector不管用 得注意下
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:drawable="@drawable/btn_left_selected"/><item android:state_pressed="true" android:drawable="@drawable/btn_left_selected"/><item android:drawable="@drawable/btn_left"/></selector>
如果第三个item你放到第一个位置的话 你选择某个RadioButton,他的背景色不会变,我这里没有一一去试,遇到情况再说
还有如果不要默认的小圆圈背景,在RadioButton控件里加个属性 android:button="@null",使其背景属性为透明
此外,RadioButton的checked属性设置为true,代码里调用RadioButton的check(id)方法,不会触发onCheckedChanged事件
至于为什么 我在api文档里找到解释
the selection is not based on the "best match," but simply the first item that meets the minimum criteria of the state.
http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList
博客已搬到 http://marspring.mobi/
- android RadioButton注意事项
- 关于RadioButton注意事项
- android RadioButton
- android RadioButton
- Android RadioButton
- RadioButton - android 自定义RadioButton样式
- [Android]定制RadioButton样式
- android 重写RadioButton
- Android RadioButton example
- Android 定制RadioButton样式
- Android 定制RadioButton样式
- Android 定制RadioButton样式
- android 自定义RadioButton样式
- android RadioButton的问题
- Android视图组件: RadioButton
- Android单选框(RadioButton)
- Android RadioButton学习笔记
- Android RadioButton的自定义
- 条件判别命令---ifc&ifn
- apache重写相关整理如下
- 归并排序(merge sort)
- HashMap的使用
- ORA-00918: column ambiguously defined解决之道
- android RadioButton注意事项
- HASH传递攻击
- VC++ 非模态对话框
- SEO知识积累
- linux广播通讯
- 黑马程序员—2、JAVA基础语法
- 简明Vim练级攻略
- Ubuntu下代替dos2unix命令 (转自两个文件)
- 编译器编译原理详解