Android and androidsdk

Source: Internet
Author: User

Android and androidsdk

Click Modify background in the view.
Change the background when pressing, and restore the background when lifting, depending on state_pressed.
After successful login, do not click and change the background, depending on state_enabled.

<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android">    <item android:drawable="@android:color/transparent"          android:state_pressed="true"/>    <item android:drawable="@android:color/transparent"          android:state_enabled="false"/>    <item android:drawable="@color/white"/></selector>

The flashing effect of the system's default click, which is supported by version 5.0 or later.
android:background="?android:attr/selectableItemBackground"

Code

<selector xmlns:android="http://schemas.android.com/apk/res/android"          android:exitFadeDuration="@android:integer/config_mediumAnimTime">    <item android:drawable="@color/transparent"          android:state_window_focused="false"/>    <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->    <item android:drawable="@drawable/list_selector_background_disabled"           android:state_enabled="false"           android:state_focused="true"           android:state_pressed="true"/>    <item android:drawable="@drawable/list_selector_background_disabled"           android:state_enabled="false"           android:state_focused="true"/>    <item android:drawable="@drawable/list_selector_background_transition"           android:state_focused="true"           android:state_pressed="true"/>    <item android:drawable="@drawable/list_selector_background_transition"           android:state_focused="false"           android:state_pressed="true"/>    <item android:drawable="@drawable/list_selector_background_focused"           android:state_focused="true"/>    <item android:drawable="@color/transparent"/></selector>

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.