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