• 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>
  • 相关阅读:
    QTimer::singleShot
    Qt 建立带有子项目的工程
    Qt GlobalColor及其显示
    QT自定义图形项中的boundingRect()和shape()函数的理解
    QT setZValue() 函数
    C++中explicit的作用及用法
    QT中foreach的使用
    QT代码封装成dll和lib文件及使用
    Qt智能指针QScopedPointer
    Qt的四个常见的图像叠加模式
  • 原文地址:https://www.cnblogs.com/xuewater/p/2731112.html
Copyright © 2020-2023  润新知