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:

822 questions
228
votes
4 answers

Method setDrawerListener is deprecated

While I'm doing something on my app, I see that the navigation drawer on my app reduced its size. But I'm not doing anything on that. Then, after checking the code, I saw that setDrawerListener is deprecated. Does anyone has a solution to this?…
david glorioso
  • 2,547
  • 2
  • 7
  • 13
76
votes
9 answers

How to customize item background and item text color inside NavigationView?

I wanna achieve something like this shown in the Material Design Docs. colorControlHighlight is used for the Background on checked items. I need to customize: background unchecked text color checked text color unchecked
68
votes
6 answers

Disable gesture listener on DrawerLayout

How can I disable the gesture recognition for the DrawerLayout? (swipe left to right) and only accept the close gesture (right to left) and open the drawer just with the home button?
Rodrigo Amaro Reveco
  • 4,512
  • 5
  • 20
  • 32
66
votes
7 answers

DrawerLayout Double Drawer (Left and Right Drawers simultaneously)

I have an application, in which i want to implement a double drawer - one from the left and one from the right. Left drawer is for app navigation, right drawer is for result filtering. So, the layout is like this:
ExiRouS
  • 782
  • 1
  • 6
  • 9
62
votes
7 answers

How to detect that the DrawerLayout started opening?

So I have tabs that I want to hide when the Navigation Drawer starts opening. The code I have hides them when it finished opening, but it's not what I want. mDrawerToggle = new ActionBarDrawerToggle( this, …
Oleksiy
  • 30,852
  • 19
  • 65
  • 114
47
votes
7 answers

How do I make DrawerLayout to display below the Toolbar?

How to make the drawer layout be below the actionbar/toolbar? I'm using v7:21 app compat library with the new ToolBar view. Examples that I see looks…
46
votes
7 answers

DrawerLayout's item click - When is the right time to replace fragment?

I'm developing an application which uses the navigation drawer pattern (With DrawerLayout). Each click on a drawer's item, replaces the fragment in the main container. However, I'm not sure when is the right time to do the fragment transaction? When…
45
votes
1 answer

Android: How do I keep DrawerLayout from passing touch events to the underlying view

I am using the Support library's DrawerLayout in my app. I noticed that, when I click on an empty area in my Drawer view, the underlying View (containing a ListView) receives the Touch event and reacts to it. The onInterceptTouchEvent method of the…
janoliver
  • 7,444
  • 12
  • 54
  • 98
41
votes
7 answers

How to open Navigation Drawer with no actionbar, open with just a button

I have a navigation bar without any actionbar (I don't want an actionbar). I'm trying to make it so that I have a button that can open the navigation drawer. I know there's a method called openDrawer for the DrawerLayout…
CynthiaDDurazo
  • 483
  • 1
  • 4
  • 10
41
votes
3 answers

vertical DrawerLayout or SlidingPaneLayout

The latest Android Support Library introduced the DrawerLayout to implement the common UX pattern where you slide right or left to show a navigation menu. What I'd love to have is a vertical DrawerLayout with the same API, that can be pulled down/up…
Mario Lenci
  • 9,844
  • 5
  • 37
  • 48
41
votes
14 answers

Full width Navigation Drawer

I'd like to create a full width navigation drawer. Setting layout_width to match_parent on @+id/left_drawer yields in width of about 80% of screen space. This seems to be the standard behavior. Do I have to override onMeasure() of DrawerLayout? My…
Martin
  • 1,647
  • 5
  • 20
  • 34
39
votes
8 answers

ClassCastException android.widget.FrameLayout$LayoutParams to android.support.v4.widget.DrawerLayout$LayoutParams

I'm working on the Navigation Drawer for Android. As per my requirement I was to display gridview and listview of items in the navigation drawer. I have created a linearLayout in the layout xml file and placed the two widgets(Grid view, and…
34
votes
4 answers

Is it possible to use something other than a listview as sliding drawer in drawerlayout

I would like to have for example a LinearLayout or a RelativeLayout sliding from the left of the screen instead of a lone ListView. I tried to use à LinearLayout with android:layout_gravity="start" and i had this error at…
BigDan
  • 517
  • 2
  • 6
  • 12
33
votes
2 answers

How animate Burger to Arrow with Appcompat v7 21, Toolbar and DrawerLayout

I am using the android.support.v7.widget.Toolbar with a android.support.v4.widget.DrawerLayout. It works fine, the Burger icon is shown when the Navigation Drawer is closed, and the Arrow icon is shown when the Drawer is open. I want to disable the…
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
  • 14,350
  • 7
  • 62
  • 86
1
2 3
54 55