It's typical for android apps that if actionbar takes more than 50% of screen width, it moves menu to bottom of screen. Obstacle is that it removes titles too no matter if they would fit or not.
In screenshot below you see comparison of same app run in 480x854 vs 320x480 screen. You can see that it moves menu in smaller screen but removes titles as well despite of that they would fit fine there.
I'm using ActionBarSherlock. According to it's creator The only way to display both would be to use a custom view in the action item that contained both an icon and text.
Can some of you folks give simple example of how to do this? I'm interested only in forcing showing titles, nothing fancy. There is nothing unusual in my app, but if you need sample source codes, I can provide them for you.
You can see that it moves menu in smaller screen but removes titles as well despite of that they would fit fine there.
AFAIK, the bottom portion of the action bar never shows titles.
Can some of you folks give simple example of how to do this?
Add an android:actionView
element to your <item>
in your <menu>
resource, pointing to a layout file that contains whatever you want your fake menu button to be:
<item
android:id="@+id/add"
android:actionLayout="@layout/add"
android:icon="@android:drawable/ic_menu_add"
android:showAsAction="ifRoom"
android:title="@string/add"/>
In your Java code, after inflating your menu resource, you can call getActionView()
on the associated MenuItem
to get at this inflated layout and configure its widgets (e.g., call setOnClickListener()
). In my case, the widget I want to configure is an EditText
:
EditText add=
(EditText)menu.findItem(R.id.add).getActionView()
.findViewById(R.id.title);
add.setOnEditorActionListener(this);
(snippets from this sample project)
Personally, I'd either get rid of the split action bar or leave it display as it does by default.