Navigation Drawer without Actionbar

不问归期 提交于 2019-11-29 12:25:05

问题


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:

  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);



来源:https://stackoverflow.com/questions/20971245/navigation-drawer-without-actionbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!