IMenu Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Interface for managing the items in a menu.
[Android.Runtime.Register("android/view/Menu", "", "Android.Views.IMenuInvoker")]
public interface IMenu : Android.Runtime.IJavaObject, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/view/Menu", "", "Android.Views.IMenuInvoker")>]
type IMenu = interface
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- Derived
- Attributes
- Implements
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(MenuItem)
and Activity#onContextItemSelected(MenuItem)
.
Different menu types support different features: <ol> <li><b>Context menus</b>: Do not support item shortcuts and item icons. <li><b>Options menus</b>: The <b>icon menus</b> do not support item check marks and only show the item's MenuItem#setTitleCondensed(CharSequence) condensed title
. The <b>expanded menus</b> (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. <li><b>Sub menus</b>: Do not support item icons, or nested sub menus. </ol>
<div class="special reference"> <h3>Developer Guides</h3>
For more information about creating menus, read the Menus developer guide.
</div>
Java documentation for android.view.Menu
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Fields
First |
First value for group and item identifier integers. |
None |
Value to use for group and item identifier integers when you don't care about them. |
SupportedModifiersMask |
A mask of all supported modifiers for MenuItem's keyboard shortcuts |
Properties
Handle |
Gets the JNI value of the underlying Android object. (Inherited from IJavaObject) |
HasVisibleItems |
Return whether the menu currently has item items that are visible. |
JniIdentityHashCode |
Returns the value of |
JniManagedPeerState |
State of the managed peer. (Inherited from IJavaPeerable) |
JniPeerMembers |
Member access and invocation support. (Inherited from IJavaPeerable) |
PeerReference |
Returns a JniObjectReference of the wrapped Java object instance. (Inherited from IJavaPeerable) |
Methods
Add(ICharSequence) |
Add a new item to the menu. |
Add(Int32, Int32, Int32, ICharSequence) |
Add a new item to the menu. |
Add(Int32, Int32, Int32, Int32) |
Variation on |
Add(Int32) |
Add a new item to the menu. |
AddIntentOptions(Int32, Int32, Int32, ComponentName, Intent[], Intent, MenuAppendFlags, IMenuItem[]) |
Add a group of menu items corresponding to actions that can be performed for a particular Intent. |
AddSubMenu(ICharSequence) |
Add a new sub-menu to the menu. |
AddSubMenu(Int32, Int32, Int32, ICharSequence) |
Add a new sub-menu to the menu. |
AddSubMenu(Int32, Int32, Int32, Int32) |
Variation on |
AddSubMenu(Int32) |
Add a new sub-menu to the menu. |
Clear() |
Remove all existing items from the menu, leaving it empty as if it had just been created. |
Close() |
Closes the menu, if open. |
Disposed() |
Called when the instance has been disposed. (Inherited from IJavaPeerable) |
DisposeUnlessReferenced() |
If there are no outstanding references to this instance, then
calls |
Finalized() |
Called when the instance has been finalized. (Inherited from IJavaPeerable) |
FindItem(Int32) |
Return the menu item with a particular identifier. |
GetItem(Int32) |
Gets the menu item at the given index. |
IsShortcutKey(Keycode, KeyEvent) |
Is a keypress one of the defined shortcut keys for this window. |
PerformIdentifierAction(Int32, MenuPerformFlags) |
Execute the menu item action associated with the given menu identifier. |
PerformShortcut(Keycode, KeyEvent, MenuPerformFlags) |
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. |
SetGroupDividerEnabled(Boolean) |
Enable or disable the group dividers. |
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. |
SetJniIdentityHashCode(Int32) |
Set the value returned by |
SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from IJavaPeerable) |
SetPeerReference(JniObjectReference) |
Set the value returned by |
SetQwertyMode(Boolean) |
Control whether the menu should be running in qwerty mode (alphabetic shortcuts) or 12-key mode (numeric shortcuts). |
Size() |
Get the number of items in the menu. |
UnregisterFromRuntime() |
Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations. (Inherited from IJavaPeerable) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
Add(IMenu, Int32, Int32, Int32, String) | |
Add(IMenu, String) | |
AddSubMenu(IMenu, Int32, Int32, Int32, String) | |
AddSubMenu(IMenu, String) | |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |