Android 8.1 screen orientation issue: flipping to landscape a portrait screen

前端 未结 10 1675
迷失自我
迷失自我 2020-12-01 03:35

I have all activities in portrait mode except the one that I use to play a video that is always landscape. I found that on Android 8.1 every time I open the video activity a

10条回答
  •  日久生厌
    2020-12-01 03:56

    This fixed the issue.

    Override the onBackPressed() method of Landscape activity and set orientation to Portrait.

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
    

提交回复
热议问题