我想从我的导航抽屉中的菜单中隐藏一个菜单项。我尝试使用 setHasOptionsMenu(true) 然后添加方法
public boolean onPrepareOptionsMenu(Menu menu){
//this is where i tried to hide the item
menu.findItem(R.id.item).setVisible(false);
}
Run Code Online (Sandbox Code Playgroud)
但它说那是空的。
有什么建议?