Android Selector detailed (background selector)

Source: Internet
Author: User

Definition: A drawable object defined in XML that can change different pictures for the same shape depending on the state. For example, there can be several different states (pressed,focused or other) for a button control, and you can use the state list to set the button's background image for each of these states.

the location of the XML: Android Selector is configured in the res/drawable/



tags and properties:android:constantsizeThis is a Boolean, false indicates the sizes (size) of each state are different, true all the states in the table have the same size (whichever is the largest). default is False
android:dither Boolean type. True indicates that if a bitmap in a screen has this different pixel configuration,enable jitter for bitmaps. False indicates that the bitmap is not enabled for jitter. According to degree Niang: dither, jitter, is a deliberate cause of noise used to randomize the quantization error, to prevent the large lifting of the image caused by the like banding (ribbon) such problems.  
android:variablepadding   The inner margin of the drawable will vary depending on the state of the default = False  
android:enterfadeduration/android:exitfadeduration drawable has multiple states, you can define the fade before it is displayed.
in the Item tab, we can configure several properties:
Green font: Focus

Android:drawable

Specify resource


Android:state_pressed

Boolean value. True refers to the state of the control when the user taps or touches it. Default is False


android:state_focused


Boolean value. Ture refers to the state of the current control when it receives focus. The default is False


android:state_hovered


Boolean value. True indicates that the cursor is moved to the state on the current control. The default is False


android:state_selected


Boolean value. True indicates the selected state, such as selecting one of the options under the arrow keys in a drop-down list.


android:state_checkable


Boolean value. Ture indicates the status that can be checked. This only works if the control has transitions between the checked and unchecked states.


android:state_checked


Boolean value. True indicates that the current control is checked (check's status)


android:state_enabled


Boolean value. True indicates that the current control is out of available state. For example, you can be clicked


android:state_activated


Boolean value. True indicates the state of the current control being activated.


android:state_window_focused


Boolean value. True indicates that the application window obtains the state of focus when the current control is out of the front.




Android Selector detailed (background selector)

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.