I'm trying and researching for some time the possibility of having behavior in my ActionBar
, as follows for some items:
- Icon (
android:icon
): always visible inActionBar
; - Text (
android:title
): only visible if there is space;
What I've already tried:
Try 1:
<item
android:id="@+id/action_add"
android:icon="@android:drawable/ic_menu_add"
android:orderInCategory="100"
android:title="@string/btn_add"
android:showAsAction="ifRoom|withText"/>
// Resultado: Mostra o item somente se houver espaço, mas o ícone juntamente com o texto
Attempt 2:
android:showAsAction="ifRoom"
// Resultado: Mostra o item somente se houver espaço, mas somente ícone sem o texto
Try 3:
android:showAsAction="always"
// Resultado: Mostra o item sempre, mas somente o ícone
Attempt 4:
android:showAsAction="always|withText"
// Resultado: Mostra o item sempre, mas o ícone juntamente com o texto
What would you like to do:
For demonstration purposes what I would have wanted would be something similar to this (there is obviously this):
// always|withIcon (sempre ícone) e ifRoom|withText (se houver espaço com texto)
android:showAsAction="always|withIcon|ifRoom|withText"
So is there any alternative to getting this behavior in a menu item of ActionBar
?