您可以使用list_selector_background因爲,作爲建議here
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@android:color/transparent" />
<!--
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:state_focused="true" android:state_enabled="false"
android:state_pressed="true" android:drawable="@drawable/list_selector_background_disabled" />
<item android:state_focused="true" android:state_enabled="false"
android:drawable="@drawable/list_selector_background_disabled" />
<item android:state_focused="true" android:state_pressed="true"
android:drawable="@drawable/list_selector_background_transition" />
<item android:state_focused="false" android:state_pressed="true"
android:drawable="@drawable/list_selector_background_transition" />
<item android:state_focused="true"
android:drawable="@+drawable/list_selector_background_focus" />
</selector>
並使用長按的轉變,作爲建議here: -
<transition xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/list_selector_background_pressed" />
<item android:drawable="@drawable/list_selector_background_longpress" />
</transition>
可能它會幫助你..
您可以使用['Transition(Drawable)'](http://developer.android.com/guide/topics/resources/drawable-resource.html#Transition)來完成此操作。對於一個真實的例子,看看作爲列表選擇器的一部分的[transition](https://github.com/JakeWharton/ActionBarSherlock/blob/master/actionbarsherlock/res/drawable/abs__list_selector_background_transition_holo_light.xml) ActionBarSherlock。 –