I know there have been many ActionBar questions but they don't seem to address my problem. I am able to spit the ActionBar in my emulator, but when I run my program on my device (Nexus 7 portrait mode) the ActionBar will not split. All the icons 'pile up' on top, even my tabs create a drop down list. I have tried to force the issue by making the menu items names extremely long and I do have them set to: android:showAsAction="always|withText". Just to be sure, I have taken sample code, ran it on the emulator seen it work and then put it on my device to no avail. Here's my manifest:
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme">
<activity
android:name=".MainActivity"
android:uiOptions="splitActionBarWhenNarrow"
android:label="@string/title_activity_main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
I have scoured the web but cannot find a solution. Any help is appreciated.
I know this question is pretty old but I've found a way to force the actionbar to the buttom on the Nexus 7 (and possible other devices) and I thought I'd share my solution:
Place this code in your Activity:
This will force the internal "split_action_bar_is_narrow" value to true. It might not be the best way to do this but it appears the be the only way I've found.
According to this SO item, the ActionBar is only splitted when the available width is less than 480dp. According to this article of Google's Dianne Hackborn however, the portrait width of the Nexus 7 is 600dp. So that's the reason there's no splitting.
I agree with you, that the splitting should depend on the relation between available space and items to be shown, not on the available space alone.