<pre>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
- <strong>xmlns:example.app="http://schemas.android.com/apk/res-auto"</strong> >
+ <strong>xmlns:yourapp="http://schemas.android.com/apk/res-auto"</strong> >
<item android:id="@+id/action_search"
android:icon="@drawable/ic_action_search"
android:title="@string/action_search"
- <strong>example.app:showAsAction="ifRoom"</strong> />
+ <strong>yourapp:showAsAction="ifRoom"</strong> />
...
</menu>
</pre>
attribute. For example:</p>
<pre>
-<item example.app:showAsAction="ifRoom|withText" ... />
+<item yourapp:showAsAction="ifRoom|withText" ... />
</pre>
<p class="note"><strong>Note:</strong> The {@code "withText"} value is a <em>hint</em> to the
<p>To enable split action bar when using the support library, you must do two things:</p>
<ol>
- <li>Add {@code uiOptions="splitActionBarWhenNarrow"} to your
-<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> or
+ <li>Add {@code uiOptions="splitActionBarWhenNarrow"} to each
+<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
+element or to the
<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
-manifest element. This attribute is understood only by API level 14 and higher (it is ignored
-by older versions).
- <li>For older versions, create a custom theme that extends one of the {@link
- android.support.v7.appcompat.R.style#Theme_AppCompat Theme.AppCompat} themes, and include
- the {@link android.support.v7.appcompat.R.attr#windowSplitActionBar windowSplitActionBar} style
- set {@code true}. For example:
- <p class="code-caption">res/values/styles.xml</p>
- <pre>
-<style name="MyAppTheme" parent="Theme.AppCompat.Light">
- <item name="windowSplitActionBar">true<item>
-</style>
-</pre>
+element. This attribute is understood only by API level 14 and higher (it is ignored
+by older versions).</li>
+ <li>To support older versions, add a <a
+ href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a>
+ element as a child of each
+ <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
+ element that declares the same value for {@code "android.support.UI_OPTIONS"}.</li>
+</ol>
- <p>Then set this as your activity theme:</p>
+<p>For example:</p>
- <p class="code-caption">AndroidManifest.xml</p>
- <pre>
+<pre>
<manifest ...>
- <activity android:theme="@style/MyAppTheme" ...>
- ...
+ <activity uiOptions="splitActionBarWhenNarrow" ... >
+ <meta-data android:name="android.support.UI_OPTIONS"
+ android:value="splitActionBarWhenNarrow" />
+ </activity>
</manifest ...>
</pre>
- </li>
-</ol>
<p>Using split action bar also allows <a href="#Tabs">navigation tabs</a> to collapse into the
<pre>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:example.app="http://schemas.android.com/apk/res-auto" >
+ xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
<item android:id="@+id/action_search"
android:title="@string/action_search"
android:icon="@drawable/ic_action_search"
- example.app:showAsAction="ifRoom|collapseActionView"
- <b>example.app:actionViewClass="android.support.v7.widget.SearchView"</b> />
+ yourapp:showAsAction="ifRoom|collapseActionView"
+ <b>yourapp:actionViewClass="android.support.v7.widget.SearchView"</b> />
</menu>
</pre>
<pre>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:example.app="http://schemas.android.com/apk/res-auto" >
+ xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
<item android:id="@+id/action_share"
android:title="@string/share"
- example.app:showAsAction="ifRoom"
- <strong>example.app:actionProviderClass="android.support.v7.widget.ShareActionProvider"</strong>
+ yourapp:showAsAction="ifRoom"
+ <strong>yourapp:actionProviderClass="android.support.v7.widget.ShareActionProvider"</strong>
/>
...
</menu>