Android Guides | Samples

Android.Views.IMenu

Interface for managing the items in a menu.

See Also: IMenu

Syntax

[Android.Runtime.Register("android/view/Menu", "", "Android.Views.IMenuInvoker")]
public interface IMenu : IJavaObject, IDisposable

Remarks

Interface for managing the items in a menu.

By default, every Activity supports an options menu of actions or options. You can add items to this menu and handle clicks on your additions. The easiest way of adding menu items is inflating an XML file into the Menu via MenuInflater. The easiest way of attaching code to clicks is via Activity.OnOptionsItemSelected(IMenuItem) and Activity.OnContextItemSelected(IMenuItem).

Different menu types support different features:

  1. Context menus: Do not support item shortcuts and item icons.
  2. Options menus: The icon menus do not support item check marks and only show the item's IMenuItem.SetTitleCondensed(ICharSequence). The expanded menus (only available if six or more menu items are visible, reached via the 'More' item in the icon menu) do not show item icons, and item check marks are discouraged.
  3. Sub menus: Do not support item icons, or nested sub menus.

Developer Guides

For more information about creating menus, read the Menus developer guide.

[Android Documentation]

Requirements

Namespace: Android.Views
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Views.IMenu are listed below.

Public Properties

[read-only]
HasVisibleItemsBoolean. Return whether the menu currently has item items that are visible.

Public Methods

Add(ICharSequence) : IMenuItem
Add a new item to the menu.
Add(Int32) : IMenuItem
Add a new item to the menu.
Add(Int32, Int32, Int32, ICharSequence) : IMenuItem
Add a new item to the menu.
Add(Int32, Int32, Int32, Int32) : IMenuItem
Variation on Menu.add(int, int, int, java.lang.CharSequence) that takes a string resource identifier instead of the string itself.
AddIntentOptions(Int32, Int32, Int32, ComponentName, Intent[], Intent, MenuAppendFlags, IMenuItem[]) : Int32
Add a group of menu items corresponding to actions that can be performed for a particular Intent.
AddSubMenu(ICharSequence) : ISubMenu
Add a new sub-menu to the menu.
AddSubMenu(Int32) : ISubMenu
Add a new sub-menu to the menu.
AddSubMenu(Int32, Int32, Int32, ICharSequence) : ISubMenu
Add a new sub-menu to the menu.
AddSubMenu(Int32, Int32, Int32, Int32) : ISubMenu
Variation on Menu.addSubMenu(int, int, int, java.lang.CharSequence) that takes a string resource identifier for the title instead of the string itself.
Clear()
Remove all existing items from the menu, leaving it empty as if it had just been created.
Close()
Closes the menu, if open.
FindItem(Int32) : IMenuItem
Return the menu item with a particular identifier.
GetItem(Int32) : IMenuItem
Gets the menu item at the given index.
IsShortcutKey(Keycode, KeyEvent) : Boolean
Is a keypress one of the defined shortcut keys for this window.
PerformIdentifierAction(Int32, MenuPerformFlags) : Boolean
Execute the menu item action associated with the given menu identifier.
PerformShortcut(Keycode, KeyEvent, MenuPerformFlags) : Boolean
Execute the menu item action associated with the given shortcut character.
RemoveGroup(Int32)
Remove all items in the given group.
RemoveItem(Int32)
Remove the item with the given identifier.
SetGroupCheckable(Int32, Boolean, Boolean)
Control whether a particular group of items can show a check mark.
SetGroupEnabled(Int32, Boolean)
Enable or disable all menu items that are in the given group.
SetGroupVisible(Int32, Boolean)
Show or hide all menu items that are in the given group.
SetQwertyMode(Boolean)
Control whether the menu should be running in qwerty mode (alphabetic shortcuts) or 12-key mode (numeric shortcuts).
Size() : Int32
Get the number of items in the menu.