Reputation: 435
How do you get rid of the 3 vertically dotted menu icon on the action bar?
I assume you use the getActionBar() method, but I'm unsure as to which method to choose from that?
Thanks!
Upvotes: 0
Views: 146
Reputation: 36449
The overflow menu appears automatically on devices without a menu key when you have too many option items. Getting rid of it shouldn't be a priority unless you absolutely do not need it.
You have a few choices.
I assume you use the getActionBar() method
Yes, you can call getActionBar().hide()
on HoneyComb and above. I don't recommend this, Why hide the whole action bar just to get rid of the overflow menu?
Or you can delete the onCreateOptionsMenu()
method from your Activity source file.
If for some reason, the overflow still appears, you're going to want to override onCreateOptionsMenu()
and return false
.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return false;
}
You can also shift the items in your menu xml file so that they all have the attribute
android:showAsAction="always"
Depending on how many items you have, this may clutter the ActionBar.
If you choose a legacy theme (such as Theme.Black) for your Activity, then if the device does not have a menu key and you have an options menu, the overflow will appear as part of the three bottom navigation buttons. That is because using legacy themes, there is no ActionBar to show, so the user still needs a way to get to the menu.
Upvotes: 2