How is application orientation (landscape or portrait) locked?

前端 未结 4 1098
春和景丽
春和景丽 2020-12-09 05:18

I have tried to freeze orientation using:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Although the display stays in

4条回答
  •  伪装坚强ぢ
    2020-12-09 05:38

    A more specific example of the activity section of the AndroidManifest.xml for portrait orientation:

        
            
                
                
            
        
    

    Where android:screenOrientation sets the initial orientation and android:configChanges voids the events that triggers the corresponding lifecycle methods on screen changes.

提交回复
热议问题