Android背景选择器selector 中enable选项失效
来源:互联网 发布:中国进口数据分析 编辑:程序博客网 时间:2024/06/05 08:03
今天在使用TextView 设置背景颜色时发现没法TextView的颜色不能设置enable = false;
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/tv_visit_bg_press"/> <item android:drawable="@drawable/tv_visit_bg_normal"/> <item android:state_enabled="false" android:drawable="@drawable/tv_disable"/></selector>
然后google了一下,发现代码中颜色匹配是顺序原则,只要找到第一个符合要求的,就不再继续往下执行了。所以只要把enable提前改成下面的顺序就可以正常展示了。
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:drawable="@drawable/tv_disable"/> <item android:state_pressed="true" android:drawable="@drawable/tv_visit_bg_press"/> <item android:drawable="@drawable/tv_visit_bg_normal"/></selector>
1 0
- Android背景选择器selector 中enable选项失效
- Android中selector背景选择器
- Android中selector背景选择器
- Android中selector背景选择器
- android selector 背景选择器
- android背景选择器selector
- android selector背景选择器
- android 背景选择器selector
- android背景选择器selector
- Android-selector背景选择器
- Android背景选择器selector
- android selector背景选择器
- Android Selector 背景选择器
- android的selector,背景选择器
- android的selector,背景选择器
- Android的selector,背景选择器
- Android 的 selector--背景选择器
- Android的selector,背景选择器
- c# petshop安装 win7 sql2008
- LinearLayout cannot be resolved to a type 解决方法
- PlayFramework “unable to create new native thread”问题
- Posix多线程编程学习笔记(二)—线程属性(3)
- web.config详解
- Android背景选择器selector 中enable选项失效
- Linux开机启动过程分析
- mysql 存储过程结合游标修改每一行记录的值
- 数组 Container With Most Water
- 二分求幂法
- 登陆csdn的时候需要点击"加载不安全的脚本"的一点想法
- Visual studio2012 C#转为C++
- struts2 <result type = "stream">
- 使用gradle构建java项目