Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Actionmenu: Show Title AND Icon

I use this code in my menu.xml:

<item android:id="@+id/physics"
        android:icon="@drawable/ic_action_***"
        android:title="@string/physics"
        android:orderInCategory="2"
        android:showAsAction="always"/>

Now my Icons aren't very much saying about the button they stand for. So I wan't display them AND the title. After long google research I found this on @stackoverflow: Android Menu Icon with Title : Title doesn't display But it's about the icons. I downloaded my icons already in the right size and put them in the right folder.

And I don't have problems with my icons, they are showing great, but when you see a line chart, you don't automatically think of physics, do you?

Any idea, how to display both? I also added a sting, it doesn't show up (is it even possible?)

like image 953
Lesik2008 Avatar asked Jan 19 '26 02:01

Lesik2008


1 Answers

Any idea, how to display both?

Replace:

android:showAsAction="always"

with:

android:showAsAction="always|withText"
like image 151
CommonsWare Avatar answered Jan 21 '26 18:01

CommonsWare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!