0

我正在使用 Phonegap 桌面应用程序创建一个应用程序,有时使用 Phonegap Build,我注意到我的网站与我的显示器一样大。

问题:不同的设备例如有一个状态栏(时钟、电池状态等),例如我的 Nexus 甚至有一个底部栏,其中显示在我的应用程序上的控制按钮。我的(带有 css 位置:固定的)导航栏在这些设备原生栏下滚动。

知道如何拒绝或减去这些条吗?如果我没有包含任何服装样式或样式库,我什至可以看到这一点

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>
4

2 回答 2

2

为避免此问题,请勿使用全屏模式:

<preference name="fullscreen" value="false" />
于 2016-05-25T16:38:56.220 回答
2

首先,我没有遇到过类似的事情,这可能只是关于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-heightconfig,我平时不使用height参数,可能是这个问题,试试去掉看看有没有变化。


此外,如果这不能解决您的问题,并且如果您想将固定导航放置在屏幕的最底部或顶部,您可以执行类似的操作。

将您的内容放入运营商 div;

<div id="carrier">
  <!--your code-->
</div>

在Javascript中;

window.onload = function(){
  document.getElementById("carrier").height = window.innerHeight;
}

在这里,我们将载体 div 的高度设置为显示屏幕的 innerHeight,请记住,innerHeight 和 outerHeight 在它们之间存在差异,因此,当您的导航进入 Nexus 上的外部屏幕视图导航下方时,这可能是您的问题。

在此处输入图像描述

同样在 CSS 中,

#carrier { position:relative; overflow:scroll; }
.yourNavElem { position:absolute; bottom:0px; left:0px;}

并将导航元素的绝对位置使用到您的载体元素中。

我不确定它是否能解决问题,但请让我更新。

于 2016-05-25T18:44:16.437 回答