Reputation: 2622
trying to create a toolbar programmatically and have run into a problem. I can add items fine, but the problem is that they all go under the same far right "more" section. No matter if I change the group id or the order every item falls under that same section. All help is greatly appreciated!
Here is the code to add the items:
public void setupToolbar(Toolbar t) {
Menu editMenu = t.getMenu();
t.setTitle(title);
editMenu.add(20, 35, 200, "Title 2");
editMenu.add(30, 45, 300, "Boom");
editMenu.add(20, 55, 200, "Boom 2");
editMenu.addSubMenu(10, 25, 100, "Title");
t.setBackgroundColor(backgroundColor);
}
Here is the result of that:
Upvotes: 1
Views: 170
Reputation: 34532
You need to set the showAsAction
attribute on your MenuItem
.
The one you are looking for ist probably always
and / or ifRoom
. Just set the correct value on the from add
returned MenuItem
.
Upvotes: 2