I've followed the development pages on the android dev site, but I cannot get my action bar to split to the top and bottom of the screen.
I've got a menu xml defined with a couple of options:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/stop_services"
android:icon="@drawable/ic_launcher"
android:title="@string/stop"
android:showAsAction="ifRoom|withText"/>
<item android:id="@+id/start_services"
android:icon="@drawable/pushpin"
android:title="@string/start"
android:showAsAction="ifRoom|withText"/>
</menu>
In my manifest I've set the uiOption to:
<activity
android:label="@string/app_name"
android:name=".ProxilenceHome"
uiOptions="splitActionBarWhenNarrow" >
I load the menu items in the activity as follows:
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.home_menu, menu);
return true;
}
But when testing the application, the action bar never splits. Does anyone know the problem/ if I've missed anything out?
Thanks a lot.
Using
android:uiOptions="splitActionBarWhenNarrow"
works for me.Without the "android:" it does not work
using this in landscape mode navigation tabs split but in portrait mode it is not work.
mainmenu.xml
in manifest.xml file
Try to add this line in your menu xml:
Then in your item element:
It helped me.