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
22
votes
1 answer

How to set up Navigation Component with Navigation Drawer in Android?

How do I set up navigation component with navigation drawer? How do I use it in my app? Can everything be done with one Activity? How do I handle toolbar visibility with just one Activity and fragments which have a dynamic toolbar visibility. Also,…
22
votes
4 answers

Side Navigation Drawer Item click not working

PLEASE READ FIRST BEFORE ANYONE MARK IT AS DUPLICATE QUESTION BECAUSE IT IS NOT. I have used Navigation Drawer, Bottom Navigation bar and a custom Action bar. Bottom navigation bar and action bar are working fine. navigation drawer also shows menu…
22
votes
3 answers

Setting Statusbar padding to NavigationView in Android

I have an activity which hosts a DrawerLayout and NavigationView from support library. I'm setting a header layout to the navigation view and I want the navigation header height to be "wrap_content". So when I set the height to "wrap_content" the…
22
votes
3 answers

dynamic adding item to NavigationView in Android

I want to build NavigationDrawer with the possibility of adding new items (such as yahoo weather App with adding new cities). I have working NavigationDrawer with NavigationView, in menu I have permanent fields:
Skye
  • 1,469
  • 3
  • 14
  • 25
22
votes
5 answers

Android support Toolbar + ActionBarDrawerToggle not changing to arrow

I'm struggling with the toolbar and drawer. I'm trying to make the burger switch to arrow when I'm adding a new fragment to the backstack but there is no way to do it. Maybe I'm missing something but I could not find a way. Anyone had the same…
Marcel
  • 2,094
  • 3
  • 23
  • 37
22
votes
6 answers

Navigation drawer Items not registering click event

I am struggling to get the Navigation drawer items to register and start and intent for a new activity. The drawer opens fine and is displayed correctly but nothing happens when I click on the items in the list. Here is my code that is taken from…
J4C3N-14
  • 686
  • 1
  • 13
  • 32
22
votes
3 answers

Navigation drawer and view pager in same activity

I am trying to implement both navigation drawer and view pager in same activity. Navigation drawer works fine but the view pager is not working, also i am getting null pointer on right swipe when navigation drawer is opened (Null pointer at…
Sunny
  • 1,066
  • 1
  • 13
  • 32
22
votes
5 answers

Touch anywhere to slide open menu for navigation drawer

For Sliding menu by jfeinstein10 (https://github.com/jfeinstein10/SlidingMenu), I can slide anywhere in the app to slide open the menu. For Google newly introduced navigation drawer…
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875
21
votes
6 answers

onNavigationItemSelected not getting called

I have implemented a navigationview in my app , which was automatically created by AndroidStudio. I picked up the NavigationDrawer Activity when I created a new project and the menu items seem ok , but nothing happend when I click on any of the menu…
Nick Su
  • 673
  • 1
  • 7
  • 11
21
votes
5 answers

How to add notification value for item on NavigationView for Material Design Drawer?

My question is very simple, how to add a notification value right of the item on NavigationView for Material Design Drawer like that ? Is there a property in the menu items for defining the drawer?
lopez.mikhael
  • 9,943
  • 19
  • 67
  • 110
21
votes
8 answers

Customising NavigationView - Adding dynamic headerView, Android Support Design Library

I tried the navigationView from the new android support design library. I want to have a dynamic headerview. Basically, my headerview will show something like quote of the day. I have like around 10 quotes and i want to randomly select a quote and…
21
votes
2 answers

Replace toolbar layout according to the displayed fragment

I have an activity with navigation drawer which replace the main_fragment_container on the activity. When one of the fragments is displayed I want to change the layout of the toolbar and add a spinner to it (and remove it when the fragment is…
Idob
  • 1,620
  • 4
  • 16
  • 27
21
votes
3 answers

Can I open the drawer layout with animation programmatically?

I created the app drawer by using the following library: http://developer.android.com/training/implementing-navigation/nav-drawer.html I want to show the Navigation Drawer with animation when opening the app. How can I do that?
benleung
  • 871
  • 4
  • 12
  • 25
20
votes
2 answers

Android - How to click on an item on a navigation drawer using Espresso?

I am new to Android development. I want to use Espresso to test that my drawer opens, then click on an item and check that it opens a new activity. I've been searching for examples about this but haven't had any luck.
josmenag
  • 253
  • 1
  • 3
  • 6
20
votes
4 answers

Overlapping shadow effect remains on Navigation Drawer's NavigationView

I have refined the Navigation Drawer Activity project template of Android Studio, which uses Toolbar, v7.app.ActionBarDrawerToggle and NavigationView instead of the NavigationDrawerFragment (and layout/fragment_navigation_drawer.xml). It is…
hata
  • 11,633
  • 6
  • 46
  • 69