zoukankan      html  css  js  c++  java
  • Android之drawable state各个属性详解

    <?xml version="1.0" encoding="UTF-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:state_selected="true" android:color="@color/white" />
        <item android:state_checked="true" android:color="@color/white" />
        <item android:color="@color/black" />
    </selector>

    官方对各个state属性的介绍如下:

    android:constantSize

    If true, the drawable's reported internal size will remain constant as the state changes; the size is the maximum of all of the states.
    android:state_activated

    State value for StateListDrawable, set when a view or its parent has been "activated" meaning the user has currently marked it as being of interest.
    android:state_active

    State value for StateListDrawable.
    android:state_checkable

    State identifier indicating that the object may display a check mark.
    android:state_checked

    State identifier indicating that the object is currently checked.
    android:state_enabled

    State value for StateListDrawable, set when a view is enabled.
    android:state_first

    State value for StateListDrawable.
    android:state_focused

    State value for StateListDrawable, set when a view has input focus.
    android:state_last       

    State value for StateListDrawable.
    android:state_middle

    State value for StateListDrawable.
    android:state_pressed

    State value for StateListDrawable, set when the user is pressing down in a view.
    android:state_selected

    State value for StateListDrawable, set when a view (or one of its parents) is currently selected.
    android:state_single

    State value for StateListDrawable.
    android:state_window_focused

    State value for StateListDrawable, set when a view's window has input focus.
    android:variablePadding

    If true, allows the drawable's padding to change based on the current state that is selected.
    android:visible

    Indicates whether the drawable should be initially visible.

    注意:如果有多个item,那么程序将自动从上到下进行匹配,最先匹配的将得到应用。(不是通过最佳匹配)
    如果一个item没有任何的状态说明,那么它将可以被任何一个状态匹配。

  • 相关阅读:
    php调用dll的实例操作动画
    刚用Mootools写了一个随着鼠标移动而背景图也跟着移动的东西
    Jquery内存溢出实况,录像会说话
    自己写个扩展把Mootools的语法改的和Jquery的语法一模一样
    一个PHP的QRcode类,与大家分享
    使用Mootools动态添加Css样式表代码,兼容各浏览器
    分享一個用Mootools剛寫的小玩意
    一周学会Mootools 1.4中文教程:(2)函数
    计算机精品学习资料大放送
    30天学会 MooTools 教学(3): 数组管理DOM元素
  • 原文地址:https://www.cnblogs.com/liaojie970/p/5841778.html
Copyright © 2011-2022 走看看