• Android selector 无效的问题


    这几天做项目,用到背景选择器,无论怎么弄, 都没有效果,找了很多资料都没有找到,样式是这样的

    <?xml version="1.0" encoding="UTF-8"?> 
    <selector xmlns:android="http://schemas.android.com/apk/res/android"> 
       <item android:drawable="@drawable/title_new_normal"/> 
        <item android:drawable="@drawable/title_new_selected" android:state_focused="true"/> 
        <item android:drawable="@drawable/title_new_selected" android:state_selected="true"/> 
        <item android:drawable="@drawable/title_new_selected" android:state_pressed="true"/> 
        <item android:drawable="@drawable/title_new_selected" android:state_enabled="false"/>     
      
    </selector>

    后来偶然间,把默认的放在最下面,就好用啦

    <?xml version="1.0" encoding="UTF-8"?> 
    <selector xmlns:android="http://schemas.android.com/apk/res/android"> 
      
        <item android:drawable="@drawable/title_new_selected" android:state_focused="true"/> 
        <item android:drawable="@drawable/title_new_selected" android:state_selected="true"/> 
        <item android:drawable="@drawable/title_new_selected" android:state_pressed="true"/> 
        <item android:drawable="@drawable/title_new_selected" android:state_enabled="false"/> 
        <item android:drawable="@drawable/title_new_normal"/> 
      
    </selector>
  • 相关阅读:
    正则表达式分组()、不捕获(?:)和断言(?<=)详解
    正则匹配IP
    正则匹配中文
    SPL--Serializable
    JavaScript中原型和原型链
    JavaScript中变量和函数声明的提升
    运行gulp提示:Task function must be specified
    vue-router 去掉#
    学以致用 ---- vue子组件→父组件通信
    删除node_modules
  • 原文地址:https://www.cnblogs.com/xuewater/p/2731112.html
Copyright © 2020-2023  润新知