0

I have a problem with the action bar in android .. I put

android:uiOptions="splitActionBarWhenNarrow"

but it's don't work i don't know why !

this the manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.ass02"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.ass02.MainActivity"
            android:label="@string/app_name"
            android:uiOptions="splitActionBarWhenNarrow" >
            <meta-data android:name="android.support.UI_OPTIONS"
                android:value="splitActionBarWhenNarrow" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

and the menu :

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:showAsAction="never"
        android:title="@string/action_settings"/>
    <item 
        android:id="@+id/item1" 
        android:title="Sequence"
        android:showAsAction="always"/>  


    <item 
        android:id="@+id/item2" 
        android:title="Summary"
        android:showAsAction="always"/>


    <item
         android:id="@+id/item3" 
         android:title=" ListView"
         android:showAsAction="always"/>

</menu>

=( but it still the menu in the top . i search for this problem a lot can any one help me

Fatom
  • 1

1 Answers1

2

This works for me

In your menu.xml you have to add the namespace xmlns:app="http://schemas.android.com/apk/res-auto", and then in your menu item app:showAsAction, like this:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"  >

<item
    android:id="@+id/addButton"
    android:showAsAction="ifRoom"
    app:showAsAction="ifRoom"
    android:title="@string/new_operation"
    android:icon="@android:drawable/ic_input_add">
</item>

</menu>