Questions tagged [navigation-drawer]

Navigation Drawer in a mobile application is the side panel which slides out from the edge of the screen and displays the navigation menu of the application. Use this tag for programming questions related to navigation drawers only. General UX questions and other opinion based questions related to navigation drawers are not on topic for Stack Overflow.

Navigation Drawer in Android

The navigation drawer is commonly used as a "slide-in" navigation menu in Android applications. It slides in from the edge of the screen and displays a list of the application's main navigation options.

The drawer slides on top of the content instead of the content sliding away. With this, one can access any top level content from anywhere in the app and allows you to create a flatter navigation structure. It also has an action bar at the top. Lower versions also support it through support library.

Documentation

  • Design docs can be found here.
  • Developer docs can be found here.
  • DrawerLayout API reference can be found here.

Related tags:

5793 questions
16
votes
12 answers

Navigation Drawer item remains selected Android

My navigation drawer keeps showing the last selected item.Is there any way to remove it.I want that if the user is at Home page, the navigation drawer items should be non-highlighted. I have tried drawer.setSelected(false); in onResume(). But it…
The Bat
  • 1,085
  • 1
  • 13
  • 31
16
votes
5 answers

Change Navigation Drawer Icon and Text Spacing

I am wondering how do we change the spacing between the icon and the text? Is it doable? Any thoughts? Thank you
JayVDiyk
  • 4,277
  • 22
  • 70
  • 135
16
votes
6 answers

Changing Navigation drawer hamburger icon

I am trying to change hamburger menu icon for NavigationView but I am unable to do so. Here is what I have tried so far I have a base activity where nav drawer setup is done. Here is relevant piece of code @Override protected void onCreate(Bundle…
16
votes
4 answers

Remove scrollbar from android support design navigation drawer?

I just updated the support design library from 22.2.1 to 23.0.1 and immediately noticed the presence of a scrollbar in the navigation drawer. I tried to use android:scrollbars="none" But that didn't fix it. Is there any other way to remove the…
16
votes
9 answers

How to select the first item in a navigation drawer and open a fragment on application start

I have created MainActivity with NavigationView. When Activity is opened I want to automatically select the first item in the navigation drawer and open Fragment under that item. I've searched a lot but didn't find any proper solutions. What is the…
Darpan Kulkarni
  • 1,362
  • 1
  • 17
  • 36
16
votes
4 answers

new ActionBarDrawerToggle when using AppCompatActivity

Today Google updated the AppCompat library to version 22.1.0, and we can now use AppCompatActivity instead of ActionBarActivity. This means we no longer need to have a Toolbar view in our activity layout. The problem is that in order to create a…
Guilherme
  • 7,839
  • 9
  • 56
  • 99
16
votes
4 answers

Up arrow does not show after calling ActionBarDrawerToggle.setDrawerIndicatorEnabled(false)

The title says it all. When I call the mDrawerToggle.setDrawerIndicatorEnabled(false) I don't want the "hamburger" icon to be shown anymore but the backwards navigation arrow. Unfortunately when I call this method just the title is shown without…
16
votes
4 answers

ActionBarDrawerToggle is not setting Drawer Indicator

I am trying to add the navigation drawer in my app.. Everything is working fine But now I still got the arrow icon although I replaced it with the ic_drawer from Android? Here's my code: private ActionBarDrawerToggle…
mudit
  • 25,306
  • 32
  • 90
  • 132
16
votes
4 answers

How to Add icons adjacent to titles for Android Navigation Drawer

I am currently working on an android app for 4.2.2 that uses the new NavigationDrawer. It works like a charm except for adding icons. I found some sample code in which the List view becomes a Relative layout in which 2 parallel arrays are nested…
greenspand
  • 749
  • 2
  • 8
  • 15
15
votes
5 answers

How to add extra item at the bottom of the drawer navigation manually (like logout button)?

I want to add logout button to the bottom of the drawer navigation in my RN app. I am trying to use contentComponent the following way: const DrawerWithLogoutButton = (props) => (
Hirurg103
  • 4,783
  • 2
  • 34
  • 50
15
votes
4 answers

Change background color of single specific menu items of navigationView

I want to set the background color of all header items in a android menu within a navigation drawer. My layout looks like:
15
votes
6 answers

Android Accessibility - Unable to focus on any element in the Appbar

I have this issue in 2 of my activities. When I navigate using keyboard Tab keys or arrow keys - I am unable to reach any element in the App bar. 1) Activity 1 -> My appbar has a hamburger menu icon to access the NavigationView. I am not able to…
15
votes
6 answers

How to add "UP" back button in fragment (Fragment to Activity)

I want to go from fragment to activity using back button using toolbar back icon. The fragment is my navigation drawer item & activity is my MainActivity. How do I do it?
15
votes
3 answers

android - Enable and Disable MenuItem on Navigation Drawer Activity Layout

I have and app created using the Navigation Drawer Activity Layout.. And I need to enable/disable some items programmatically Menu Example Example: I want to disable the Menu Item id nav_item2 I tried to do... MenuItem nav_item2 =…
15
votes
7 answers

Navigation View Multiline Text

I have an app with a Navigation View for my DrawerLayout. I add programmatically items in the menu because I receive the information over the network. But sometimes, an item name can be very long and is just cut off with even having the ellipsize…
dequec64
  • 923
  • 1
  • 8
  • 26