简体   繁体   中英

How to open NavigationDrawer in portrait mode while my activity is in landscape?

So, I am trying to open NavigationDrawer in portratit mode, but I have to lock my activity in landscape mode due to some reason.

I have tried to set gravity to left or right but all of them open NavigationDrawer as it should open in LandScape mode, but I want it to ope in Portrait mode.

There is nothing in documentation about such case and from what I know Navigation Drawer is usually used from sides.

You may however check gravity

https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html#openDrawer%28int%29

There are also other navigation components like Bottom navigation which may fit better in your case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM