Share via


IMenu.Add Method

Definition

Overloads

Add(ICharSequence)

Add a new item to the menu.

Add(Int32)

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(int, int, int, CharSequence) that takes a string resource identifier instead of the string itself.

Add(ICharSequence)

Add a new item to the menu.

[Android.Runtime.Register("add", "(Ljava/lang/CharSequence;)Landroid/view/MenuItem;", "GetAdd_Ljava_lang_CharSequence_Handler:Android.Views.IMenuInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Views.IMenuItem? Add (Java.Lang.ICharSequence? title);
[<Android.Runtime.Register("add", "(Ljava/lang/CharSequence;)Landroid/view/MenuItem;", "GetAdd_Ljava_lang_CharSequence_Handler:Android.Views.IMenuInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Add : Java.Lang.ICharSequence -> Android.Views.IMenuItem

Parameters

title
ICharSequence

The text to display for the item.

Returns

The newly added menu item.

Attributes

Remarks

Add a new item to the menu. This item displays the given title for its label.

Java documentation for android.view.Menu.add(java.lang.CharSequence).

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.

Applies to

Add(Int32)

Add a new item to the menu.

[Android.Runtime.Register("add", "(I)Landroid/view/MenuItem;", "GetAdd_IHandler:Android.Views.IMenuInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Views.IMenuItem? Add (int titleRes);
[<Android.Runtime.Register("add", "(I)Landroid/view/MenuItem;", "GetAdd_IHandler:Android.Views.IMenuInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Add : int -> Android.Views.IMenuItem

Parameters

titleRes
Int32

Resource identifier of title string.

Returns

The newly added menu item.

Attributes

Remarks

Add a new item to the menu. This item displays the given title for its label.

Java documentation for android.view.Menu.add(int).

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.

Applies to

Add(Int32, Int32, Int32, ICharSequence)

Add a new item to the menu.

[Android.Runtime.Register("add", "(IIILjava/lang/CharSequence;)Landroid/view/MenuItem;", "GetAdd_IIILjava_lang_CharSequence_Handler:Android.Views.IMenuInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Views.IMenuItem? Add (int groupId, int itemId, int order, Java.Lang.ICharSequence? title);
[<Android.Runtime.Register("add", "(IIILjava/lang/CharSequence;)Landroid/view/MenuItem;", "GetAdd_IIILjava_lang_CharSequence_Handler:Android.Views.IMenuInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Add : int * int * int * Java.Lang.ICharSequence -> Android.Views.IMenuItem

Parameters

groupId
Int32

The group identifier that this item should be part of. This can be used to define groups of items for batch state changes. Normally use #NONE if an item should not be in a group.

itemId
Int32

Unique item ID. Use #NONE if you do not need a unique ID.

order
Int32

The order for the item. Use #NONE if you do not care about the order. See MenuItem#getOrder().

title
ICharSequence

The text to display for the item.

Returns

The newly added menu item.

Attributes

Remarks

Add a new item to the menu. This item displays the given title for its label.

Java documentation for android.view.Menu.add(int, int, int, java.lang.CharSequence).

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.

Applies to

Add(Int32, Int32, Int32, Int32)

Variation on #add(int, int, int, CharSequence) that takes a string resource identifier instead of the string itself.

[Android.Runtime.Register("add", "(IIII)Landroid/view/MenuItem;", "GetAdd_IIIIHandler:Android.Views.IMenuInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Views.IMenuItem? Add (int groupId, int itemId, int order, int titleRes);
[<Android.Runtime.Register("add", "(IIII)Landroid/view/MenuItem;", "GetAdd_IIIIHandler:Android.Views.IMenuInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Add : int * int * int * int -> Android.Views.IMenuItem

Parameters

groupId
Int32

The group identifier that this item should be part of. This can also be used to define groups of items for batch state changes. Normally use #NONE if an item should not be in a group.

itemId
Int32

Unique item ID. Use #NONE if you do not need a unique ID.

order
Int32

The order for the item. Use #NONE if you do not care about the order. See MenuItem#getOrder().

titleRes
Int32

Resource identifier of title string.

Returns

The newly added menu item.

Attributes

Remarks

Variation on #add(int, int, int, CharSequence) that takes a string resource identifier instead of the string itself.

Java documentation for android.view.Menu.add(int, int, int, int).

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.

Applies to