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.