Change screen orientation in Android without reloading the activity

前端 未结 5 731
梦谈多话
梦谈多话 2020-12-16 10:40

I want to change the orientation programmatically while running my Android App, with these lines of code:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTA         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-16 10:53

    You need to override onSaveInstanceState(Bundle savedInstanceState) and write the application state values you want to change to the Bundle parameter

提交回复
热议问题