我在修复index.html页面的屏幕方向时遇到问题。我想允许应用程序旋转,但主页上除外。我明白将以下内容添加到您的活动中 - android:screenOrientation =“portrait”会阻止屏幕旋转。
但是,我需要设置它,以便它是特定于页面的。我正在使用phonegap,因此需要停止我的网页浏览页面。
我尝试在我的清单中调用以下活动 - com.phonegap.droidgap.index.html,但这不起作用。
有人可以建议我如何定义1页的固定方向吗?
提前致谢
我在修复index.html页面的屏幕方向时遇到问题。我想允许应用程序旋转,但主页上除外。我明白将以下内容添加到您的活动中 - android:screenOrientation =“portrait”会阻止屏幕旋转。
但是,我需要设置它,以便它是特定于页面的。我正在使用phonegap,因此需要停止我的网页浏览页面。
我尝试在我的清单中调用以下活动 - com.phonegap.droidgap.index.html,但这不起作用。
有人可以建议我如何定义1页的固定方向吗?
提前致谢
您可以使用Android的PhoneGap插件:
https://github.com/champierre/pg-plugin-screen-orientation
并添加到index.html页面onload:
navigator.screenOrientation.set('portrait');
您可以使用Android的PhoneGap插件:
https://github.com/champierre/pg-plugin-screen-orientation
并添加到index.html页面onload:
navigator.screenOrientation.set('portrait');
例如,您可以使用代码设置屏幕方向 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
看到 http://developer.android.com/reference/android/app/Activity.html#setRequestedOrientation%28int%29 。在AndroidManifest.xml中,您只能将其设置为全局选项。