Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>To override <code>ActionBarSherlock</code> themes you should proceed like this:</p> <p>Open <code>values/abs__themes.xml</code> from <code>ActionBarSherlock</code> library project. You see for example:</p> <pre><code>&lt;style name="Theme.Sherlock" parent="Sherlock.__Theme"&gt; &lt;!-- Action bar styles (from Theme.Holo) --&gt; &lt;item name="actionDropDownStyle"&gt;@style/Widget.Sherlock.Spinner.DropDown.ActionBar&lt;/item&gt; &lt;item name="actionButtonStyle"&gt;@style/Widget.Sherlock.ActionButton&lt;/item&gt; &lt;item name="actionOverflowButtonStyle"&gt;@style/Widget.Sherlock.ActionButton.Overflow&lt;/item&gt; &lt;item name="actionModeBackground"&gt;@drawable/abs__cab_background_top_holo_dark&lt;/item&gt; &lt;item name="actionModeSplitBackground"&gt;@drawable/abs__cab_background_bottom_holo_dark&lt;/item&gt; &lt;item name="actionModeCloseDrawable"&gt;@drawable/abs__ic_cab_done_holo_dark&lt;/item&gt; &lt;item name="actionBarTabStyle"&gt;@style/Widget.Sherlock.ActionBar.TabView&lt;/item&gt; ... // Here is what you wanted &lt;item name="actionBarItemBackground"&gt;@drawable/abs__item_background_holo_dark&lt;/item&gt; ... </code></pre> <p>When you have found the item you want to customize (<code>actionBarItemBackground</code> in your case), you create your own <code>themes.xml</code> inside your project, and add in it:</p> <pre><code>&lt;style name="Custom.Theme.Sherlock" parent="@style/Theme.Sherlock"&gt; &lt;item name="actionBarItemBackground"&gt;@drawable/my__item_background_holo_dark&lt;/item&gt; &lt;/style&gt; </code></pre> <p>This overrides the default <code>Theme.Sherlock</code>, setting a custom <code>actionBarItemBackground</code>.</p> <p>Now, instead of using <code>Theme.Sherlock</code> in your activity you should use <code>setTheme(R.style.Custom_Theme_Sherlock)</code>. You may also want to override the other two themes (<code>Theme.Sherlock.Light</code> and <code>Theme.Sherlock.Light.DarkActionBar</code>)</p> <p>One more tip, here is the drawable selector used by <code>ActionBarSherlock</code> for the default action item background (in holo_light), it uses 9-patch png drawables:</p> <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. --&gt; &lt;item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/abs__list_selector_disabled_holo_light" /&gt; &lt;item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/abs__list_selector_disabled_holo_light" /&gt; &lt;item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/abs__list_selector_background_transition_holo_light" /&gt; &lt;item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/abs__list_selector_background_transition_holo_light" /&gt; &lt;item android:state_focused="true" android:drawable="@drawable/abs__list_focused_holo" /&gt; &lt;item android:drawable="@android:color/transparent" /&gt; </code></pre> <p></p> <hr> <p>For other basic customizing, you can use this <a href="http://jgilfelt.github.com/android-actionbarstylegenerator/#name=example&amp;compat=holo&amp;theme=light&amp;actionbarstyle=solid&amp;backColor=E4E4E4,100&amp;secondaryColor=D6D6D6,100&amp;tertiaryColor=F2F2F2,100&amp;accentColor=33B5E5,100">tool</a>, it generates styles for you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload