I can't seem to get an image and text to work in portrait mode on menu items in the action bar no matter what I try. I even tried to force android portrait orientation
My XML:
<item android:id="@+id/menu_save"
android:icon="@drawable/content"
android:orderInCategory="100"
android:title="New Group"
android:showAsAction="withText|always" />
Has anyone figured this out?
Ahmad's answer makes clear why this is not possible. It is annoying that the action bar is not easier to customise.
One quick and dirty solution is to put two buttons in the menu, remove the icon from one and give the second a different name. Then in the corresponding java file, replicate the functionality for the extra button in onOptionsItemSelected. This gets over having to create a custom view for the action bar.
I also saw this answer but didn't try it: withText in split ActionBar #Google Calendar Method. This is how it is done in Google Calendar but also relies on a custom view replacing the action bar.
From the config.xml file of the native ActionBar:
values:
values-480dp:
To answer your question:
No you can't do that, if the devices width is smaller than 480dp. (Unless you want to create a custom rom with a modded framework)
The easiest way to do it is: