0

How to hide 3 dots from Navigation header which comes in the right of header? This could be repeated question. I found few similar questions and their answers but they were for older version of Android. I am using Android sdk 21.

Any idea how to hide that 3 dot button?

NGR
  • 1,230
  • 2
  • 15
  • 44

4 Answers4

1

Those "3 Dots" are the "Overflow" menu, and is created when you establish a menu using a file in the menu resources directory.

If you have buttons or functionality you are wanting to expose via you action bar, you will need to have the overflow buttons (or instead, you can choose to have your buttons exposed at the top level inside the Action bar.

If you really don't want a menu, get rid of the menu.xml file describing this menu, and then get rid of the onCreateOptionsMenu() from your Activity.

Here are the official docs, which describe how this works.

Booger
  • 18,579
  • 7
  • 55
  • 72
1

Just Remove Override Method like this

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.search_and_add, menu);
    return true;
}

This Override Method is responsible to for creating three dote as you mention it's really OptionMenu. If you don't want it, don't override onCreateOptionsMenumethod.

Alternative

Don't Inflate the menu xml. Just block the line like this

//getMenuInflater().inflate(R.menu.search_and_add, menu);

other code can remain same. No problem at all..

0

I think you are speaking about the options menu, to get rid of it remove the override of the method onCreateOptionsMenu

Jameido
  • 1,344
  • 1
  • 11
  • 21
0

In your menu folder the xmlfile that is used by your activity, change the app:showAsAction="never" to app:showAsAction="always" or some other you can see the options that are availabe by pressing ctrl+space.

Or else to get rid of it completely just remove the whole code and it's corresponding usages.

Praneet Pabolu
  • 340
  • 2
  • 12