Reputation: 501
I'm adding a SubMenu at runtime and everything works great.
I just have a problem: how to set showAsAction="always"
on a runtime-added SubMenu?
There is no method to achieve that and if don't set it I can't find any way to have it shown in the Action Bar.
Thanks for helping
Upvotes: 2
Views: 485
Reputation: 13
Call yourSubMenu.getItem()
. This give you MenuItem that represent the SubMenu.
Upvotes: 1
Reputation: 41
Don't know if this is too late or not, but SubMenu has as function called getItem() which returns a MenuItem. You can then get this MenuItem, and call setShowAsAction() afterwards. Hope this helps!!!
Upvotes: 4
Reputation: 204
If im right then
MenuItem = item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
Upvotes: 0