문제

I'm using a drawer with multiple fragments in both orientation, now I want to lock the orientation of one screen, so I'm using this:

getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

but when this fragment comes on screen the whole app lock in portrait (because its using drawer activity context so each fragment get locked).

도움이 되었습니까?

해결책

You just use this code only in Activity So you are using the Drawer Layout in your Main activity I think So you set this code in your MainActivity that will work definitely....

  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

You just put this code .where you created the drawer layout activity...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top