How to display both icon and title of action inside ActionBar?

Alexey Zakharov picture Alexey Zakharov · Aug 17, 2012 · Viewed 111.5k times · Source

I need to display both icon and title of action inside ActionBar.

I've tried "withText" option, but it has no effect.

enter image description here

Answer

Yibo Long picture Yibo Long · May 26, 2013

'always|withText' will work if there is sufficient room, otherwise it will only place icon. You can test it on your phone with rotation.

<item android:id="@id/menu_item"
android:title="text"
android:icon="@drawable/drawable_resource_name"
android:showAsAction="always|withText" />