好,ABS用途(幾乎)相同的API作爲默認的ActionBar所以只是改變(副本)的主題,回答是這樣的:
<style name="myStyle" parent="Theme.Sherlock">
<item name="android:selectableItemBackground">@android:drawable/item_background_holo_dark</item>
<item name="selectableItemBackground">@android:drawable/item_background_holo_dark</item>
</style>
而繪製:
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:drawable="@drawable/list_selector_disabled_holo_dark" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/list_selector_disabled_holo_dark" android:state_enabled="false" android:state_focused="true"/>
<item android:drawable="@drawable/list_selector_background_transition_holo_dark" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/list_selector_background_transition_holo_dark" android:state_focused="false" android:state_pressed="true"/>
<item android:drawable="@drawable/list_focused_holo" android:state_focused="true"/>
<item android:drawable="@color/transparent"/>
</selector>
你只是從Theme.Sherlock
繼承你的風格,並設置其他selectableItemBackground
屬性,但沒有前面的android:
。
好的謝謝,我從來沒有處理過這樣的風格文件。它在哪裏?我看到應該有一個'res/styles /'目錄,但我沒有。是因爲我在一個較低的API? – JuiCe
不,只需在res/values /那裏你應該有一個styles.xml文件。 – Ahmad
對不起,但我仍然沒有得到它的工作。如果你有時間,我已經編輯了更多信息和錯誤信息。 – JuiCe