Android - Fix screen orientation for 1 page only (phonegap)

后端 未结 2 1440
攒了一身酷
攒了一身酷 2020-12-10 13:45

I am having an issue with fixing the screen orientation for my index.html page only. I want to allow the app to rotate except on the home page. I understand that adding the

相关标签:
2条回答
  • 2020-12-10 14:20

    You can set the screen orientation from you code using for example setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); see http://developer.android.com/reference/android/app/Activity.html#setRequestedOrientation%28int%29 . In the AndroidManifest.xml you can set it only as a global option.

    0 讨论(0)
  • 2020-12-10 14:30

    You can use this PhoneGap Plugin for Android:

    https://github.com/champierre/pg-plugin-screen-orientation

    And add to your index.html page onload:

    navigator.screenOrientation.set('portrait');
    
    0 讨论(0)
提交回复
热议问题