问题
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!
回答1:
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);
回答2:
Starting from the Sample Android NavigationDrawer app:
- Use the Activity theme: Theme.NoTitleBar
- Erase all the ActionBar references in the code
Create a button and in the clickListener call:
drawer.openDrawer(Gravity.LEFT);
来源:https://stackoverflow.com/questions/20971245/navigation-drawer-without-actionbar