简体   繁体   中英

Phonegap: Force screen orientation portrait/landscape

I'm using Phonegap Desktop/CLI to test my app. I'd like to force the screen orientation to be portrait.

I've added this line to my config.xml: <preference name="orientation" value="portrait" />

Then I run "phonegap serve". This works neither from Android or iOS.

The app screen listens to the orientation of the phone, turning from portrait to landscape as you rotate it.

Looks like this is unsupported with "phonegap serve". I had to build the app package (apk/android ipa/ios) and install it to my device to get it to work.

I used build.phonegap.com but I guess you can use the SDK's aswell.

With this plugin you can force orientation

https://github.com/gbenvenuti/cordova-plugin-screen-orientation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM