Reputation: 1263
I am using PhoneGap, and am working with an Android web based app.
How do I disable screen rotation for only one page?
I have searched for this solution but all the solutions say to disable screen rotation in the AndroidManifest.xml file. However, this disables rotation for the whole app. I only need to disable rotation for one page.
Can this be done using PhoneGap / Javascript code? I am not using any Java code.
Thanks.
Upvotes: 6
Views: 14330
Reputation: 199
This is simple way to lock rotation:
1/. Edit in config.xml file:
<preference name="orientation" value="portrait" />
2/. Put this code into Android Manifestxml file in:
<activity>
...
android:screenOrientation="portrait"
...
</activity>
Upvotes: 2
Reputation: 172
You can simply remove the following tag or set it at 'portrait' in your config.xml file :
<preference name="orientation" value="portrait" />
For more informations, read the phonegap documentation :
https://build.phonegap.com/docs/config-xml
Upvotes: 5
Reputation: 56
I know this post is a few months old but there is a plugin for phonegap which can help you... It is a plugin that can lock or unlock screen orientation.
OrientationLock - Android PhoneGap
Upvotes: 4