Does anyone have an example of adding a submenu to an options menu in
XML? I'm interested in doing something like this Java example (from
the Google developer guide, Creating Menus):

public boolean onCreateOptionsMenu(Menu menu) {
  boolean result = super.onCreateOptionsMenu(menu);

  SubMenu fileMenu = menu.addSubMenu("File");
  SubMenu editMenu = menu.addSubMenu("Edit");
  fileMenu.add("new");
  fileMenu.add("open");
  fileMenu.add("save");
  editMenu.add("undo");
  editMenu.add("redo");

  return result;
}


However, I designed my options menu in XML, using the visual layout
editor. I tried putting several items within a group, like this:

<group android:enabled="true" android:visible="true"
android:menuCategory="container" android:id="@+id/update_group">
        <item android:title="Facebook" android:id="@+id/facebook"></item>
        <item android:title="MySpace" android:id="@+id/myspace"></item>
</group>

But instead of getting a submenu, I got additional items on the
options menu, which created an extended menu.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to