简体   繁体   中英

Disable popup button on ActionBar that has settings menu item

My action bar has this button on the top right :

在此输入图像描述

And when I click it, it gives me a settings menu item which does nothing on click:

在此输入图像描述

I would like to disable the button in the first picture (looks like an ellipsis but rotated) from my ActionBar.

How would I go about doing that?

This is the default overflow menu that is set by the SDK when you create a new Android project.

To disable the menu you just have to remove the code that adds it. You should have a method onCreateOptionsMenu() overridden somewhere in your Activity, which you can remove.

selects a contextual menu item

@Override
    public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            return false; // Return false if nothing is done
}

more info here - http://developer.android.com/guide/topics/ui/menus.html#context-menu

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM