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!
To add a navigation drawer, first declare a DrawerLayout as the root view. Inside the DrawerLayout , add a layout for the main UI content and another view that contains the contents of the navigation drawer.
Android Navigation Drawer is a sliding left menu that is used to display the important links in the application. Navigation drawer makes it easy to navigate to and fro between those links. It's not visible by default and it needs to opened either by sliding from left or clicking its icon in the ActionBar.
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);
Starting from the Sample Android NavigationDrawer app:
Create a button and in the clickListener call:
drawer.openDrawer(Gravity.LEFT);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With