Questions tagged [drawerlayout]

Android's DrawerLayout acts as a top-level container for window content that allows for interactive "drawer" views to be pulled out from the edge of the window.

Android's DrawerLayout acts as a top-level container for window content that allows for interactive "drawer" views to be pulled out from the edge of the window. It is commonly known as Android Navigation Drawer.

As per the Android Design guide, any drawers positioned to the left/start should always contain content for navigating around the application, whereas any drawers positioned to the right/end should always contain actions to take on the current content. This preserves the same navigation left, actions right structure present in the Action Bar and elsewhere.

The DrawerLayout class is available in the Android Support Library (android.support.v4.widget.DrawerLayout).

Some Useful links - Official API Reference and Navigation Drawer Example

Tag Usage:

843 questions
32
votes
2 answers

How to implement a DrawerLayout with a visible handle

I have successfully implemented a NavigationDrawer for my application. My app displays a drawer that opens on the left of the screen. My problem is I need to add a button on the left. That button might be clicked or swiped to open the left drawer.…
Armel Larcier
  • 15,747
  • 7
  • 68
  • 89
31
votes
5 answers

how to set unread notification count in NavigationView of DrawerLayout?

I have created one NavigationView inside DrawerLayout using Android Design Support Library
25
votes
10 answers

Android Toolbar + Tab Layout + Drawer, Hide toolbar when scrolling and take TabLayout to the top

I have activity which has drawer attached to it. Each menu of the drawer is a fragment, and under one of the menu I have a fragment with TabLayout, and each tab contains a RecyclerView. So now, when I scroll the RecyclerView, tab layout is getting…
25
votes
4 answers

What do you need to pass to v4.widget.DrawerLayout.isDrawerOpen()/.openDrawer()/.closeDrawer()

I've been trying to move my code across to the DrawerLayout as suggested by android here as SlidingDrawer is deprecated. My problem is that so far DrawerLayout seems to be either very badly implemented, has unhelpful error messages (no defensive…
Graeme
  • 25,714
  • 24
  • 124
  • 186
24
votes
1 answer

CustomDrawerLayout from four screen sides issue with Fling gesture and detection

I am trying to create and improve existing SlidingDrawers projects that can work for all four sides of the screen {LEFT, RIGHT, TOP, BOTTOM}. There are a few libraries, however, they all have limitations, complications and bugs. One of the more…
portfoliobuilder
  • 7,556
  • 14
  • 76
  • 136
24
votes
8 answers

DrawerLayout.openDrawer does not work the first time

I am using a android.support.v4.widget.DrawerLayout in my activity. As long as I use the swipe gesture to open it, it works fine. However, when I want to open it through a button click by calling drawer.openDrawer(Gravity.LEFT), it does not…
user2527666
  • 433
  • 5
  • 14
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
20
votes
1 answer

Android, what is equivalent class of DrawerLayout when not using support library?

Since my minimum SDK version is 14, I don't want to add support library to my application. Based on what Android says on DrawerLayout page, this view group is defined in support library (android.support.v4.widget). Is there any equivalent class of…
Hesam
  • 52,260
  • 74
  • 224
  • 365
19
votes
4 answers

Android DrawerLayout doesn't show the right indicator icon

I'm trying to use the new DrawerLayout for a list. The problem is though I set the drawer listener, the indicator on the actionbar is still the arrow icon instead of the 3-line icon which I intends to draw. The following is the OnCreate…
zhengbli
  • 702
  • 5
  • 24
19
votes
3 answers

In Robolectric, how do I get around DrawerLayout must be measured with MeasureSpec.EXACTLY error?

I'm trying to add a DrawerLayout to my application for navigation, and I'm testing my application with Robolectric (I've seen this problem both with Robolectric 2.1.1 and 2.1-SNAPSHOT - 2.2-20130712.161723-17) I'm using the following xml for the…
Hilary Karls
  • 243
  • 2
  • 7
18
votes
7 answers

toolbar.setNavigationOnClickListener not working

toolbar.setNavigationOnClickListener this function is not working have no clue why. activity_main.xml…
PedroAGSantos
  • 2,336
  • 2
  • 17
  • 34
18
votes
5 answers

Show DrawerLayoutAndroid via ToolbarAndroid => onIconClicked

I'm new to React native (and React) and I'm playing around a little bit with it. I managed to add a DrawerLayout that I can drag from the left of my screen. However I'd like to open it when I click on my menu icon in my ToolbarAndroid. I tried to…
Maslow
  • 1,084
  • 9
  • 22
17
votes
8 answers

Error inflating class android.support.v4.widget.drawerlayout

I've done numerous searches on this topic. I have done the following: Made sure the support library was up to date via the SDK Manager. Went into the build path and the order and export tab to make sure dependencies were checked. Cleaned my…
user3241191
  • 505
  • 2
  • 5
  • 12
17
votes
5 answers

how to set Drawer Layout icon in right side of the device screen?

I have created drawer layout sample application, it's working fine, my problem is drawer layout working in right to left perfectly but I am trying to move icon left side to right side but it's not working give me your suggestion..!!! This is…
balaji
  • 1,555
  • 5
  • 26
  • 49
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
1
2
3
56 57