2

私にはいくつかのアクションがあり、それらはすべて正しく表示されます。ただし、アクションをクリックすると、色がデフォルトの青みがかった色として表示され、アプリではひどく見えます。アクションの「選択した」色を変更するにはどうすればよいですか?

これは基本的にの複製ですが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ファイルでは、スタイル名は私のものと完全に一致します。

4

1 に答える 1

1

そうですね、ABSはデフォルトのActionBarと(ほぼ)同じAPIを使用しているので、次のように(重複した)回答のテーマを変更するだけです。

<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:、前に置くことはできません。

于 2013-01-24T18:57:09.607 に答える