32

I searched many sites (stackoverflow as well) but couldn't understand how to implement the navigation drawer without the action bar. I know that this question has already been asked here but it doesn't have a proper explanation and code. I am a beginner in android development so can anyone please explain me with code How to make a navigation drawer without an action bar

Thanks in advance!

Chinmay Dabke
  • 5,070
  • 11
  • 40
  • 63

2 Answers2

22

Just add your DrawerLayout like @mohan did, then if you have a button or something you tap on and want to open the drawer, just do like this :

drawer.openDrawer(Gravity.LEFT);

and to close :

drawer.closeDrawer(Gravity.LEFT);
Mehdiway
  • 10,337
  • 8
  • 36
  • 68
  • 8
    Android Studio prefer to use Gravity.START instead of Gravity.LEFT. because of in some locales typing left to right it gives rendering issue. – mehmet Mar 28 '17 at 09:07
8

Starting from the Sample Android NavigationDrawer app:

  1. Use the Activity theme: Theme.NoTitleBar
  2. Erase all the ActionBar references in the code
  3. Create a button and in the clickListener call:

    drawer.openDrawer(Gravity.LEFT);

Kim Sant
  • 386
  • 4
  • 7