问题
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