Android - 仅修复 1 页的屏幕方向(phonegap) [英] Android - Fix screen orientation for 1 page only (phonegap)

查看:16
本文介绍了Android - 仅修复 1 页的屏幕方向(phonegap)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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 following into you activity - android:screenOrientation="portrait" stops the screen from rotating.

但是,我需要将其设置为特定于页面.我正在使用 phonegap,因此需要停止浏览网页.

However, I need to set this so it is page specific. I am using phonegap and therefore, need to stop my web view pages.

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

I tried calling the following activity within my manifest - com.phonegap.droidgap.index.html, however this did not work.

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

Could someone please advice me as to how I can define the fixed orientation for 1 page only?

提前致谢

推荐答案

你可以使用这个 PhoneGap Plugin for Android:

You can use this PhoneGap Plugin for Android:

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

并在加载时添加到您的 index.html 页面:

And add to your index.html page onload:

navigator.screenOrientation.set('portrait');

这篇关于Android - 仅修复 1 页的屏幕方向(phonegap)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆