android selector--item

    xiaoxiao2021-04-19  170

    <item> Defines a drawable to use during certain states, as described by its attributes. Must be a child of a <selector> element.

    attributes:

    android:drawable Drawable resource. Required. Reference to a drawable resource. android:state_pressed Boolean. "true" if this item should be used when the object is pressed (such as when a button is touched/clicked); "false" if this item should be used in the default, non-pressed state. android:state_focused Boolean. "true" if this item should be used when the object is focused (such as when a button is highlighted using the trackball/d-pad); "false" if this item should be used in the default, non-focused state. android:state_selected 被选中的状态。在做标签页的时候用到了。一个默认,一个选中。 Boolean. "true" if this item should be used when the object is selected (such as when a tab is opened); "false" if this item should be used when the object is not selected. android:state_checkable Boolean. "true" if this item should be used when the object is checkable; "false" if this item should be used when the object is not checkable. (Only useful if the object can transition between a checkable and non-checkable widget.) android:state_checked Boolean. "true" if this item should be used when the object is checked; "false" if it should be used when the object is un-checked. android:state_enabled Boolean. "true" if this item should be used when the object is enabled (capable of receiving touch/click events); "false" if it should be used when the object is disabled. android:state_window_focused Boolean. "true" if this item should be used when the application window has focus (the application is in the foreground), "false" if this item should be used when the application window does not have focus (for example, if the notification shade is pulled down or a dialog appears).

    Note: Remember that Android applies the first item in the state list that matches the current state of the object. So, if the first item in the list contains none of the state attributes above, then it is applied every time, which is why your default value should always be last (as demonstrated in the following example).

    转载请注明原文地址: https://ju.6miu.com/read-676145.html

    最新回复(0)