added in version 22.1.0
belongs to Maven artifact


public class DrawerLayout
extends ViewGroup

   ↳ android.view.View
     ↳ android.view.ViewGroup

DrawerLayout acts as a top-level container for window content that allows for interactive "drawer" views to be pulled out from one or both vertical edges of the window.

Drawer positioning and layout is controlled using the android:layout_gravity attribute on child views corresponding to which side of the view you want the drawer to emerge from: left or right (or start/end on platform versions that support layout direction.) Note that you can only have one drawer view for each vertical edge of the window. If your layout configures more than one drawer view per vertical edge of the window, an exception will be thrown at runtime.

To use a DrawerLayout, position your primary content view as the first child with width and height of match_parent and no layout_gravity>. Add drawers as child views after the main content view and set the layout_gravity appropriately. Drawers commonly use match_parent for height with a fixed width.

DrawerLayout.DrawerListener can be used to monitor the state and motion of drawer views. Avoid performing expensive operations such as layout during animation as it can cause stuttering; try to perform expensive operations during the STATE_IDLE state. DrawerLayout.SimpleDrawerListener offers default/no-op implementations of each callback method.

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.

For more information about how to use DrawerLayout, read Creating a Navigation Drawer.


Nested classes

interface DrawerLayout.DrawerListener

Listener for monitoring events about drawers. 

class DrawerLayout.LayoutParams


class DrawerLayout.SavedState

State persisted across instances  

class DrawerLayout.SimpleDrawerListener

Stub/no-op implementations of all methods of DrawerLayout.DrawerListener



The drawer is locked closed.


The drawer is locked open.


The drawer's lock state is reset to default.


The drawer is unlocked.


Indicates that a drawer is currently being dragged by the user.


Indicates that any drawers are in an idle, settled state.


Indicates that a drawer is in the process of settling to a final position.

Inherited constants

From class android.view.ViewGroup