Android drawable State various properties

Source: Internet
Author: User

<?XML version= "1.0" encoding= "UTF-8"?><selectorxmlns:android= "Http://schemas.android.com/apk/res/android">    <Itemandroid:state_selected= "true"Android:color= "@color/white" />    <Itemandroid:state_checked= "true"Android:color= "@color/white" />    <ItemAndroid:color= "@color/black" /></selector>

The official description of each state attribute is as follows:

XML Attributes
Attribute Name Related Method Description
Android:constantsize If true, the drawable ' s reported internal size would remain constant as the state changes; The size is the maximum of the states.
android:state_activated State value StateListDrawable for, set when a view or its parent have been "activated" meaning the user has currently marked it as Bein g of interest.
Android:state_active State value for StateListDrawable .
Android:state_checkable State identifier indicating, the object may display a check mark.
Android:state_checked State identifier indicating, the object is currently checked.
Android:state_enabled State value StateListDrawable for, set when a view is enabled.
Android:state_first State value for StateListDrawable .
Android:state_focused State value StateListDrawable for, 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 StateListDrawable for, set if the user is pressing a view.
android:state_selected State value StateListDrawable for, set when a view (or one of it parents) is currently selected.
Android:state_single State value for StateListDrawable .
Android:state_window_focused State value StateListDrawable for, 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, which is selected.
Android:visible Indicates whether the drawable should be initially visible.

Note: If you have more than one item, the program will automatically match from top to bottom, and the first match will be applied. (not through Best Bets)
If an item does not have any status descriptions, it will be able to be matched by any one of the states.

Android drawable State various properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.