Вопрос

I would like to write under the text in the action bar so i use this xml:

 <item
    android:id="@+id/Home"
    android:icon="@drawable/ic_action_home"
    android:showAsAction="always|withText"
    android:title="home"/>
<item
    android:id="@+id/Refresh"
    android:icon="@drawable/ic_action_refresh"
    android:orderInCategory="100"
    android:showAsAction="always|withText"
    android:title="refresh"/>

although i write:

  android:showAsAction="always|withText"

this what i get :

enter image description here

How could I write text under the icons ?

Это было полезно?

Решение

'always|withText' only works if there is sufficient room. Else, it will only place icon. In your case, you've got several icons there which does not leave any spare room for text.

You've got two options:

  1. Reduce the icons by moving them either to an overflow menu or somewhere else in your UI.
  2. Design images which consist both icon and text and use them as your icons.

Edit: Well, here's a lot better answer: https://stackoverflow.com/a/12225863/2511884

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top