From 84f2a0f5e7a2ae63f4bc64f494b2aa6c94e7eb5a Mon Sep 17 00:00:00 2001 From: Scott Main Date: Wed, 24 Jul 2013 07:57:05 -0700 Subject: revise split action bar and xml namespace Change-Id: If60759d25ccd965dde6f3fc604af2ef1dce2053d --- docs/html/guide/topics/ui/actionbar.jd | 56 ++++++++++++++++------------------ 1 file changed, 26 insertions(+), 30 deletions(-) (limited to 'docs/html/guide') diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd index 34cf2a822fa6..be58493ee9c2 100644 --- a/docs/html/guide/topics/ui/actionbar.jd +++ b/docs/html/guide/topics/ui/actionbar.jd @@ -253,11 +253,11 @@ showAsAction="ifRoom"} in the {@code <item>} tag. For example:

 <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:icon="@drawable/ic_action_search"
           android:title="@string/action_search"
-          example.app:showAsAction="ifRoom"  />
+          yourapp:showAsAction="ifRoom"  />
     ...
 </menu>
 
@@ -281,7 +281,7 @@ want to display the text title, add {@code "withText"} to the {@code showAsActio attribute. For example:

-<item example.app:showAsAction="ifRoom|withText" ... />
+<item yourapp:showAsAction="ifRoom|withText" ... />
 

Note: The {@code "withText"} value is a hint to the @@ -372,33 +372,29 @@ items on a narrow screen, while leaving room for navigation and title elements a

To enable split action bar when using the support library, you must do two things:

    -
  1. Add {@code uiOptions="splitActionBarWhenNarrow"} to your -{@code <activity>} or +
  2. Add {@code uiOptions="splitActionBarWhenNarrow"} to each +{@code <activity>} +element or to the {@code <application>} -manifest element. This attribute is understood only by API level 14 and higher (it is ignored -by older versions). -
  3. 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: -

    res/values/styles.xml

    -
    -<style name="MyAppTheme" parent="Theme.AppCompat.Light">
    -  <item name="windowSplitActionBar">true<item>
    -</style>
    -
    +element. This attribute is understood only by API level 14 and higher (it is ignored +by older versions).
  4. +
  5. To support older versions, add a {@code <meta-data>} + element as a child of each + {@code <activity>} + element that declares the same value for {@code "android.support.UI_OPTIONS"}.
  6. +
-

Then set this as your activity theme:

+

For example:

-

AndroidManifest.xml

-
+
 <manifest ...>
-    <activity android:theme="@style/MyAppTheme" ...>
-    ...
+    <activity uiOptions="splitActionBarWhenNarrow" ... >
+        <meta-data android:name="android.support.UI_OPTIONS"
+                   android:value="splitActionBarWhenNarrow" />
+    </activity>
 </manifest ...>
 
- -

Using split action bar also allows navigation tabs to collapse into the @@ -571,12 +567,12 @@ the {@link android.support.v7.widget.SearchView} widget:

 <?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"
-          example.app:actionViewClass="android.support.v7.widget.SearchView" />
+          yourapp:showAsAction="ifRoom|collapseActionView"
+          yourapp:actionViewClass="android.support.v7.widget.SearchView" />
 </menu>
 
@@ -719,11 +715,11 @@ the {@link android.support.v7.widget.ShareActionProvider} class. For example:

<?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" - example.app:actionProviderClass="android.support.v7.widget.ShareActionProvider" + yourapp:showAsAction="ifRoom" + yourapp:actionProviderClass="android.support.v7.widget.ShareActionProvider" /> ... </menu> -- cgit v1.2.3-59-g8ed1b