在我的 Fragment
中,我想使用 Toolbar
- Activity
中没有。如何在此 工具栏
中使用 OptionMenu?
最佳答案
toolbar = (Toolbar) fragmentView.findViewById(R.id.toolbar);
toolbar.inflateMenu(R.menu.your_menu);
toolbar.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()){
//Do your magic
}
return true;
}
});
关于android - 如何在 fragment View 中的工具栏上使用 OptionMenu?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40361988/