Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This answer is basically <a href="https://stackoverflow.com/users/328152/niko34">niko34's</a> but in a little bit more detail. Currently I have both the top actionbar and the lower actionbar (the lower actionbar is more properly named as the <a href="https://developer.android.com/guide/topics/ui/actionbar.html#SplitBar" rel="nofollow noreferrer">split actionbar</a>) styled the same, but you'll see it's pretty darn simple to style them differently. I am using <a href="http://actionbarsherlock.com/" rel="nofollow noreferrer">ActionBarSherlock</a> v4.2.0, and have tested and run this flawlessly on both a Samsung Galaxy S3 running Jelly Bean and an HTC Droid Incredible running Gingerbread. </p> <h2>AndroidManifest.xml</h2> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="..." android:versionCode="1" android:versionName="0.1" &gt; &lt;uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" /&gt; &lt;application android:icon="@drawable/launcher" android:label="@string/app_name" &gt; &lt;activity android:label="@string/main_activity_title" android:name=".MainActivity" android:screenOrientation="portrait" android:theme="@style/Theme.Styled" android:uiOptions="splitActionBarWhenNarrow" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <h2>res/values/themes.xml</h2> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar"&gt; &lt;item name="actionBarStyle"&gt;@style/Widget.Styled.ActionBar&lt;/item&gt; &lt;item name="android:actionBarStyle"&gt;@style/Widget.Styled.ActionBar&lt;/item&gt; &lt;/style&gt; &lt;style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse"&gt; &lt;item name="background"&gt;@drawable/bg_actionbar&lt;/item&gt; &lt;item name="android:background"&gt;@drawable/bg_actionbar&lt;/item&gt; &lt;item name="backgroundSplit"&gt;@drawable/bg_actionbar&lt;/item&gt; &lt;item name="android:backgroundSplit"&gt;@drawable/bg_actionbar&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>Here you can see how I'm referencing <code>@drawable/bg_actionbar</code> a couple of times. That is an xml file that is located in the <code>res/drawable</code> directory. Below is the source of that file.</p> <h2>res/drawable/bg_actionbar.xml</h2> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:dither="true" android:src="@drawable/bg_tile" android:tileMode="repeat" /&gt; </code></pre> <p>Here, <code>android:src="@drawable/bg_tile"</code> is just referencing my <code>bg_tile.png</code> file, which is located in <code>res/drawable-hdpi</code>, <code>res/drawable-ldpi</code>, <code>res/drawable-mdpi</code>, and <code>res/drawable-xhdpi</code>. </p> <p>So all of this was probably more information than necessary, but it's better than not having enough! :)</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