androidnavigation-drawerandroid-navigationviewandroid-drawer

Android: Hide 3 dots from Navigation view header at right


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?


Solution

  • 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..