0

I tried android:visibility="gone" and android:visibility="invisible". I also tried android:enabled="false". It will only disable the menu item, but I need to completely hide it (so it should not even show the space allocated for that item).

What changes can I make to the XML so that a menu item can be hidden?

Lino
  • 5,084
  • 3
  • 21
  • 39
Dr.
  • 11
  • 3
  • What does it mean, if you are writing an item that is `invisible`? there is no space, no action, no nothing – Paresh P. Aug 28 '17 at 05:52
  • try this link https://stackoverflow.com/questions/10692755/how-do-i-hide-a-menu-item-in-the-actionbar – akhilesh0707 Aug 28 '17 at 05:57
  • 1
    Specifically, [this answer](https://stackoverflow.com/a/39324927). The correct attribute setting is `android:visible="false"`. – Mike M. Aug 28 '17 at 06:01

1 Answers1

4
<item
    android:id="@+id/action_settings"
    **android:visible="false"**
    android:orderInCategory="100"
    android:title="@string/action_settings"
    app:showAsAction="never" />

This worked for me.