应用程序屏幕大于 Android 和 WP 上的视图
app screen is bigger than view on Android and WP
我正在使用 Phonegap 桌面应用程序创建一个应用程序,有时使用 Phonegap Build,我注意到我的网站和我的显示器一样大。
问题: 不同的设备有状态栏(时钟、电池状态等),例如我的 Nexus 甚至有一个带有控制按钮的底部栏显示在我的应用程序上。我的(css position:fixed)导航栏在这些设备原生栏下滚动。
知道如何拒绝或减去这些栏吗?如果我有 NO 服装样式或样式库,我什至可以看到它。
HTML
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1,
maximum-scale=1, minimum-scale=1, width=device-width,
height=viewport-height, target-densitydpi=device-dpi" />
<title>Streetreporter</title>
<!-- jQuery library -->
<script src="libs/jQuery/jquery-1.12.4.js" type="text/javascript"></script>
<script type="text/javascript" src="cordova.js"></script>
</head>
<body >
TO DO content
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>
CONFIG.xml ## 缩短
<?xml version="1.0" encoding="UTF-8"?>
<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "app.streetreporter"
version = "0.1.0">
<name>Streetreporter+Camera API Test</name>
<description>
Hello World sample application that responds to the deviceready event.
</description>
<author href="http://phonegap.com" email="support@phonegap.com">
PhoneGap Team
</author>
<content src="index.html"/>
<preference name="permissions" value="none"/>
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="true" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="disable-cursor" value="false" />
<preference name="android-installLocation" value="auto" />
</widget>
为避免此问题,请不要使用全屏模式:
<preference name="fullscreen" value="false" />
首先,我没有遇到过类似的事情,这可能只是关于nexus?
似乎问题仅与视口配置中的视口高度有关;
<meta name="viewport" content="user-scalable=no, initial-scale=1,
maximum-scale=1, minimum-scale=1, width=device-width,
height=viewport-height, target-densitydpi=device-dpi" />
有height=viewport-height
配置,我一般不用height参数,可能是这个问题,去掉试试看有没有变化。
此外,如果这不能解决您的问题,并且如果您想将固定导航放置在屏幕的最底部或顶部,您可以这样做。
将您的内容放入载体div;
<div id="carrier">
<!--your code-->
</div>
在Javascript;
window.onload = function(){
document.getElementById("carrier").height = window.innerHeight;
}
这里我们把carrierdiv的高度设置成显示屏幕的innerHeight,注意innerHeight和outerHeight是有区别的,这可能是你的navigation获取时的问题在 Nexus 的外屏视图导航下。
也在 CSS、
#carrier { position:relative; overflow:scroll; }
.yourNavElem { position:absolute; bottom:0px; left:0px;}
并在载体元素中使用导航元素的绝对位置。
我不确定它是否有效,但请让我了解最新情况。
我正在使用 Phonegap 桌面应用程序创建一个应用程序,有时使用 Phonegap Build,我注意到我的网站和我的显示器一样大。
问题: 不同的设备有状态栏(时钟、电池状态等),例如我的 Nexus 甚至有一个带有控制按钮的底部栏显示在我的应用程序上。我的(css position:fixed)导航栏在这些设备原生栏下滚动。
知道如何拒绝或减去这些栏吗?如果我有 NO 服装样式或样式库,我什至可以看到它。
HTML
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1,
maximum-scale=1, minimum-scale=1, width=device-width,
height=viewport-height, target-densitydpi=device-dpi" />
<title>Streetreporter</title>
<!-- jQuery library -->
<script src="libs/jQuery/jquery-1.12.4.js" type="text/javascript"></script>
<script type="text/javascript" src="cordova.js"></script>
</head>
<body >
TO DO content
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>
CONFIG.xml ## 缩短
<?xml version="1.0" encoding="UTF-8"?>
<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "app.streetreporter"
version = "0.1.0">
<name>Streetreporter+Camera API Test</name>
<description>
Hello World sample application that responds to the deviceready event.
</description>
<author href="http://phonegap.com" email="support@phonegap.com">
PhoneGap Team
</author>
<content src="index.html"/>
<preference name="permissions" value="none"/>
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="true" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="disable-cursor" value="false" />
<preference name="android-installLocation" value="auto" />
</widget>
为避免此问题,请不要使用全屏模式:
<preference name="fullscreen" value="false" />
首先,我没有遇到过类似的事情,这可能只是关于nexus?
似乎问题仅与视口配置中的视口高度有关;
<meta name="viewport" content="user-scalable=no, initial-scale=1,
maximum-scale=1, minimum-scale=1, width=device-width,
height=viewport-height, target-densitydpi=device-dpi" />
有height=viewport-height
配置,我一般不用height参数,可能是这个问题,去掉试试看有没有变化。
此外,如果这不能解决您的问题,并且如果您想将固定导航放置在屏幕的最底部或顶部,您可以这样做。
将您的内容放入载体div;
<div id="carrier">
<!--your code-->
</div>
在Javascript;
window.onload = function(){
document.getElementById("carrier").height = window.innerHeight;
}
这里我们把carrierdiv的高度设置成显示屏幕的innerHeight,注意innerHeight和outerHeight是有区别的,这可能是你的navigation获取时的问题在 Nexus 的外屏视图导航下。
也在 CSS、
#carrier { position:relative; overflow:scroll; }
.yourNavElem { position:absolute; bottom:0px; left:0px;}
并在载体元素中使用导航元素的绝对位置。
我不确定它是否有效,但请让我了解最新情况。