zoukankan      html  css  js  c++  java
  • Android设置Selector不同状态下颜色及图片

    Selector常用状态:

          Android:state_selected 控件选中状态,可以为true或false

          android:state_focused 控件获得焦点状态,可以为true或false

          android:state_pressed 控件点击状态,可以为true或false

          android:state_enabled 控件使能状态,可以为true或false

          android:state_checkable 控件可勾选状态,可以为true或false

          android:state_checked 控件勾选状态,可以为true或false

    设置不同状态下颜色:

          btn_enabled.xml

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">   

    <!-- 默认 -->
        <item android:state_enabled="true">
            <color android:color="#e25050" />
            </item>
     <item android:state_enabled="false">
            <color android:color="#908e8e" />
            </item>
    </selector>

    设置不同状态下图片:

        btn_pressed.xml

    <?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/btn_arrow_left_pressed" />
        <item android:state_window_focused="true" android:state_focused="true" android:drawable="@drawable/btn_arrow_left_pressed" />
        <item android:state_window_focused="false" android:state_focused="false" android:drawable="@drawable/btn_arrow_left_normal" />
    </selector>

  • 相关阅读:
    Linux 命令[5]:rmdir
    Linux 命令[4]:pwd,date
    Linux 命令[0]:起航
    Linux 命令[3]:cd
    vscode插件
    Object.freeze()
    插件
    前端开发调试线上代码
    前端自动化测试是浪费时间还是节约时间?
    踩坑之用lrz插件进行图片压缩
  • 原文地址:https://www.cnblogs.com/miaozhenzhong/p/5930906.html
Copyright © 2011-2022 走看看