How to set orientation in nativescript

前端 未结 4 449
面向向阳花
面向向阳花 2020-12-15 07:50

Hello I would like to know how to set device orientation in nativescript. Specifically I want the application that I am writing to stay in the same orientation (portrait) a

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-15 08:18

    You will have to update your AndroidManifest.xml & Info.plist in your App_Resources.

    AndroidManifest.xml

    Set screenOrientation to portrait on your main activity

    
    

    Info.plist

    Keep only the portrait orientation, remove rest from UISupportedInterfaceOrientations.

    UISupportedInterfaceOrientations
    
      UIInterfaceOrientationPortrait
    
    UISupportedInterfaceOrientations~ipad
    
      UIInterfaceOrientationPortrait
      UIInterfaceOrientationPortraitUpsideDown
    
    

    Note: Make sure you run a clean build after these changes.

提交回复
热议问题