如果我理解正确,MenuInflater是一种可以填充(展开、扩展?)菜单类型对象的对象。
但是这个方法什么时候被调用,哪个菜单对象会自动传入?
getMenuInflater()是做什么用的(还是它只是另一种方式的... = new MenuInflater())?
然后一旦填充对象被创建,.inflate到底做了什么?
传入的菜单对象如何处理我的main.xml菜单?
(如果我一次问太多问题,我很抱歉。)
(如果我一次问太多问题,我很抱歉。)
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return super.onCreateOptionsMenu(Menu);
}