Change screen orientation in Android without reloading the activity

前端 未结 5 733
梦谈多话
梦谈多话 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:52

    See the edit by @luisfer. For targeting Android 3.2 and above, you need BOTH

    android:configChanges="orientation|screenSize"
    

    http://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange

提交回复
热议问题