问题描述:
目前在 phonegap 中开发代码,使用 requirejs、backbone 和 jquery。如果我在 android 手机上显示应用程序并且屏幕垂直保持(宽度比高度窄),那么页面的渲染不会占据整个宽度(停留在 95% 左右)。如果我旋转手机,那么屏幕将占据 100% 的可见宽度。
即使在体内设置 div 的宽度也不会呈现 100% ...
显示的设备具有 android 2.3.5 版本,并且在 phonegap 上的构建具有
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
HTML 和 CSS:
以下是 index.html 和相关的 css:
<body>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=1, initial-scale=1, minimum-scale=1, maximum-scale=1.0, width=device-width, height=device-height, target-densityDpi=device-dpi" />
<...and host of css....>
</head>
<header class="header">
<img .....some image/>
</header>
<div id="page-wrap">
<div class="mcontent"></div>
</div>
<!-- native libs -->
<script type="text/javascript" src="cordova.js"></script>
<!-- third party libs -->
<script type="text/javascript" data-main="js/scripts/main" src="js/scripts/vendor/require.js"></script>
</body></html>
和CSS:
body {
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
-webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
font-size:12px;
margin:0px;
padding:0px;
/* text-transform:uppercase;*/
height: 100%;
overflow-x:hidden;
}
#page-wrap{
background: none repeat scroll 0 0 #FFFFFF;
display:block;
}
.header{
height:100px;
background:#ccff33; /* #4fd5d6; */
width:100%;
}
.header .logo{
padding-top:10px;
padding-left:20px;
height:60px;
line-height:100px;
font-height:60px;
font-weight:bold;
}
css 中的关键内容:Body 包含"overflow-x": hidden
并且视口是从 phonegap 设置的默认值。
任何关于如何纠正他的线索将不胜感激......