2

我有幾個操作都可以正確顯示。然而,當我點擊這些動作時,顏色會以默認的藍色顯示,並且與我的應用程序看起來很糟糕。我如何改變Action的'selected'顏色?如何使用ActionBarSherlock更改動作的觸摸效果顏色?

這基本上是this question的副本,除了一個不處理ActionBarSherlock。

編輯

使用公認的答案,我調整style.xml

錯誤後收到此錯誤是error: Error retrieving parent for item: No resource found that matches given name 'Theme'.

我進入到我的style.xml文件完全一樣如下。在Sherlock庫/res/values/abs_themes.xml文件中,樣式名稱與我的完全匹配。

回答

1

好,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:

+0

好的謝謝,我從來沒有處理過這樣的風格文件。它在哪裏?我看到應該有一個'res/styles /'目錄,但我沒有。是因爲我在一個較低的API? – JuiCe

+0

不,只需在res/values /那裏你應該有一個styles.xml文件。 – Ahmad

+0

對不起,但我仍然沒有得到它的工作。如果你有時間,我已經編輯了更多信息和錯誤信息。 – JuiCe

相關問題