Most visited

Recently visited

Added in API level 1

MenuInflater

public class MenuInflater
extends Object

java.lang.Object
    android.view.MenuInflater


该类用于将菜单XML文件实例化为Menu对象。

出于性能原因,菜单通胀严重依赖于在构建时完成的XML文件的预处理。 因此,目前无法在运行时使用带有XmlPullParser的普通XML文件的MenuInflater; 它仅适用于从编译资源返回的XmlPullParser(R. something文件)。

摘要(Summary)

Public constructors

MenuInflater(Context context)

构建一个菜单inflater。

公共方法(Public methods)

void inflate(int menuRes, Menu menu)

从指定的XML资源中填充菜单层次结构。

继承方法(Inherited methods)

From class java.lang.Object

Public constructors

MenuInflater

Added in API level 1
MenuInflater (Context context)

构建一个菜单inflater。

参数(Parameters)
context Context

也可以看看:

公共方法(Public methods)

inflate

Added in API level 1
void inflate (int menuRes, 
                Menu menu)

从指定的XML资源中填充菜单层次结构。 如果出现错误,则抛出InflateException

参数(Parameters)
menuRes int: Resource ID for an XML layout resource to load (e.g., R.menu.main_activity)
menu Menu: The Menu to inflate into. The items and submenus will be added to this Menu.

Hooray!