Android Action Bar Two Line Text Labels

2019-07-20 04:05发布

问题:

Is there a way (perhaps some special character along the lines of non-breaking spaces) that I can force the menu items in my Action Bar to have two line labels? I think this just looks better than long, single-line tab labels...

Thanks,
R.

Edit, additional info: My apologies, I have so far managed to avoid needing the overflow menu, probably because I'm developing for a Nexus 7 with a nice large screen. To clarify, one of my menu tabs (in the action bar proper) is "Restore Defaults", but I think it would look better if it was:

Restore
Defaults

Is there something I can incorporate into my Strings.xml file to force the Action Bar to display the item like that? When I used longer names for all five menu items, "Restore Defaults" DID display on two lines (but it was the only one). Anyway, I know it's possible, just not how to do it on purpose.

回答1:

Since toadzky does not make an answer of his comment, I will:

Insert a '\n' in the title of your menu item. that should make it wrap.

As soon as he puts it up as an answer, I will delete mine and you can accept his, but this way at least the question can be officially closed.