Android - 仅限1页固定屏幕方向(phonegap)

Raj*_*ana 11 javascript java android orientation cordova

我在修复index.html页面的屏幕方向时遇到问题.我想允许应用程序旋转,除了在主页上.我明白将以下内容添加到您的活动中 - android:screenOrientation ="portrait"会阻止屏幕旋转.

但是,我需要设置它,以便它是特定于页面的.我正在使用phonegap,因此需要停止我的网页浏览页面.

我尝试在我的清单中调用以下活动 - com.phonegap.droidgap.index.html,但这不起作用.

有人可以建议我如何定义1页的固定方向吗?

提前致谢

Răz*_*nda 14

您可以使用Android的PhoneGap插件:

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

并添加到index.html页面onload:

navigator.screenOrientation.set('portrait');
Run Code Online (Sandbox Code Playgroud)