Override onPrepareOptionsMenu()
in the fragment of the preference with this:
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem item= menu.findItem(R.id.menu_settings);
item.setVisible(false);
super.onPrepareOptionsMenu(menu);
return true;
}
if you have more then one item set all the items visibility flag to false
and add the command setHasOptionsMenu(true);
to the onCreate
command
after you will set all the visibility of the items to false the menu will disappear
on activity, the only difference is the onPrepareOptionsMenu
is boolean
and you don't need to add the setHasOptionsMenu(true);
command on the creation
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…