共用方式為


MenuInflater.Inflate(Int32, IMenu) Method

Definition

Inflate a menu hierarchy from the specified XML resource.

[Android.Runtime.Register("inflate", "(ILandroid/view/Menu;)V", "GetInflate_ILandroid_view_Menu_Handler")]
public virtual void Inflate (int menuRes, Android.Views.IMenu? menu);
[<Android.Runtime.Register("inflate", "(ILandroid/view/Menu;)V", "GetInflate_ILandroid_view_Menu_Handler")>]
abstract member Inflate : int * Android.Views.IMenu -> unit
override this.Inflate : int * Android.Views.IMenu -> unit

Parameters

menuRes
Int32

Resource ID for an XML layout resource to load (e.g., R.menu.main_activity)

menu
IMenu

The Menu to inflate into. The items and submenus will be added to this Menu.

Attributes

Remarks

Inflate a menu hierarchy from the specified XML resource. Throws InflateException if there is an error.

Java documentation for android.view.MenuInflater.inflate(int, 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.

Applies to