0

my minSdkVersion is 8 and targetSdkVersion is 21

the manifest `

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:uiOptions="splitActionBarWhenNarrow"
        android:name="com.example.coco.myapplication.MainActivity"
        android:label="@string/app_name" >
        <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>

`

the menu

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
<item android:id="@+id/action_settings" android:title="@string/action_settings"
    android:orderInCategory="100" app:showAsAction="never" />


<item
    android:id="@+id/test1"
    android:title="test1"
    android:icon="@drawable/ic_launcher"
    app:showAsAction="ifRoom|withText" />

in the preview of android studio i could see the item is on the bottom, but when i run it on either emulator or device they are on the top,I have create a new project to test but it also doesn't work, how to solve it?thanks

plus: i don't know the attribute "whennarrow" mean ,is that mean the device size is narrow or the space for action buttons is narrow?if it is the first,how should i judge whether the device is narrow or wide,if it is the second,how many items will lead to the action bar to split?

cajsaiko
  • 1,017
  • 1
  • 8
  • 15
  • Did you know that the split action bar is only used on -small/-normal screens in portrait orientation -- in all other cases, the action bar behaves normally without a split? – Rami Nov 13 '14 at 10:39
  • i know this,i have added many items before,even they show at the overflow button,they didn't go to the bottom,but i have found some app have less items than that they are on the bottom,and i can't understand even there are only two items, in the preview they are at the bottom – cajsaiko Nov 13 '14 at 10:59
  • try those solutions : --1) http://stackoverflow.com/a/8417972/4224337 --2) http://stackoverflow.com/a/23755114/4224337 – Rami Nov 13 '14 at 11:15
  • i have added the "android:" prefix,and indeed the second i have tried before and it doesn't work.. i will try it again later – cajsaiko Nov 13 '14 at 11:26
  • i found someone who has the same problem,maybe the new appcompat library changes some features but i can't confirm it – cajsaiko Nov 14 '14 at 01:50

0 Answers0