Baloch
Baloch

Reputation: 3

How to hide menu icon from ActionBar

How to hide the menu Button (3 vertical dots) from ActionBar, I created custom action bar but some devices still showing default menu icon on right side ActionBar.

I just want to hide menu Button (3 vertical dots) but not the menu functionality.

Here is the screenshot

Upvotes: 0

Views: 1686

Answers (2)

Rod_Algonquin
Rod_Algonquin

Reputation: 26198

It is called a Overflow and one way to hide it is overriding your onPrepareOptionsMenu method and find the overflow button and set its visibility to false

sample:

    @Override
    public boolean onPrepareOptionsMenu(Menu menu) {
       // if nav drawer is opened, hide the action items
       menu.findItem(R.id.menu_settings).setVisible(false);
       return super.onPrepareOptionsMenu(menu);
    }

Upvotes: 1

manitaz
manitaz

Reputation: 1180

get the menu icon at the extreme right of the action bar

Either:

You have defined items to appear in the overflow area, in which case, get rid of those, or

Your android:targetSdkVersion is under 11, in which case, raise it

see this post for more information http://android-developers.blogspot.com/2012/01/say-goodbye-to-menu-button.html

Upvotes: 0

Related Questions