Android Navigation Drawer Open On Activity Create

牧云@^-^@ 提交于 2019-12-11 10:46:22

问题


I do have a simple requirement. I want new android Navigation Drawer to open upon start of Activity.

I have tried

mDrawerLayout.openDrawer(drawerListView);

in onCreate of host activity. But it didn't work.

Any kind of help would be appreciated. Thank you.


回答1:


try to move the code to onResume() and set a flag that the action is done so it won't happen every time activity goes foreground




回答2:


put this line

mDrawerLayout.openDrawer(drawerListView);

at the end of onCreate it workes fine.



来源:https://stackoverflow.com/questions/18783833/android-navigation-drawer-open-on-activity-create

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