How to disable/hide three-dot indicator(Option menu indicator) on ICS handsets

后端 未结 19 1812
闹比i
闹比i 2020-12-04 19:29

How to disable/hide three-dot indicator(Option menu indicator) on ICS handsets which does\'t have menu button. ?

I am running application as

19条回答
  •  一整个雨季
    2020-12-04 19:49

    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

提交回复
热议问题