Add separators between groups of actions bar menu items
I am creating an android action bar menu for an application. I'm looking for a way to show logical groupings of menu items. So, I have a:
Whereas I would like:
I am creating a menu like this:
@Override
public boolean onCreateOptionsMenu(Menu menu){
//Note, on 2.3.x - 3.0 this is called when user opens the menu for the first timed
//on 3.0+ it is called when the activity starts
MenuInflater inflater = getMenuInflater();
//adds the (currently empty) menu, after login it will be filled with options
inflater.inflate(R.menu.menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu){
menu.add("example");
menu.add("example");
return true;
}
XML Menu:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:compat="http://schemas.android.com/apk/res-auto"
>
</menu>
I was hoping that menu groups would help, but I understand that they are only for changing all properties of menu items. At the same time, the submenu actually creates a hidden menu that opens freely when clicked.
Is there a way to create this logical grouping of menu items I'm looking for?
+3
source to share
No one has answered this question yet