Android selector background and transparent color

Source: Internet
Author: User
Tags transparent color

Selector can set the click effect of the picture or layout:

<?xml version="1.0"encoding="Utf-8"? ><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true"android:drawable="@drawable/card_photo_toolbar_p_night"/> <item android:state_pressed="true"android:drawable="@drawable/card_photo_toolbar_p_night"/> <item android:state_selected="true"android:drawable="@drawable/card_photo_toolbar_p_night"/> <item android:drawable="@drawable/card_photo_toolbar_p_night"/></selector>

If there is no state status token, such as android:state_selected= "true", the picture value in the normal state is indicated.

Another if directly <item android:drawable= "@drawable/card_photo_toolbar_p_night"/> removed, think and normal state is a completely transparent diagram, equivalent to

<item  android:drawable="@color/transparent" />= #00000000

Also, Android provides a transparent value:

@android: color/transparent, this value can be set when a transparent background is set.

However, it was found in application development that the value is not always the same as #00000000

Specific reason unknown ....

Continuation: @android: The color/transparent value is not getting the problem of the android4.0 system itself, and after Setttheme, there is an error in retrieving it again. This issue does not occur after the previous version.

The solution is to use a transparent picture of. 9.png instead.

Android selector background and transparent color

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.