erp
erp

Reputation: 3034

button that is just text in action bar

I was wondering if you can just put plain text as a button in the action bar. I was messing around with a spinner, but i just dont really care for how it looks, but I do like how it says something instead of a picture (icon). I dont really like how its forced on the lfet side of the action bar by my icon.

Can i just make a 'button' that says options that I can make appear on the right side. In one of my other apps I did this on the right side, but it was just using an icon as a menu. Can you use a text button as a menu?

Upvotes: 0

Views: 886

Answers (2)

S.Thiongane
S.Thiongane

Reputation: 6915

Try to remove the android:icon attribute from your menu XML :

<item android:id="@+id/my_id"
          android:title="@string/my_string"
          android:showAsAction="ifRoom|withText" />

Or try to use the Icon Generator from here, chose the Text tab and generate your icons with the provided text.

Upvotes: 1

Adam S
Adam S

Reputation: 16414

In your menu.xml, you simply remove the android:icon="@drawable/ic_someicon" entry. This means that the Action Bar entry becomes whatever is in the android:title="@string/some_menu_title" attribute instead; that is, it becomes a button with text rather than a button with an icon.

Upvotes: 1

Related Questions