简体   繁体   English

如何防止Android Samsung平板电脑上的带Phonegap的Jquery Mobile使用横向高度作为纵向高度?

[英]How can I prevent Jquery Mobile with Phonegap on an Android Samsung tablet from using the landscape height for the portrait height?

This is an odd one and I do have a work around, though it seems there must be a more reasonable approach. 这是一个奇怪的问题,我确实有一个解决方法,尽管似乎必须有一个更合理的方法。 For a mobile app that works well on iPhones, iPads and Android phones; 对于可在iPhone,iPad和Android手机上正常运行的移动应用; when distributing it on a Samsung Galaxy Tablet (the only non-Apple tablet I have) running Android 3.2 it attempts to set the portrait height the dimensions of the landscape height and leaves whitespace below it. 在运行Android 3.2的Samsung Galaxy Tablet(我拥有的唯一非Apple平板电脑)上分发它时,它会尝试将纵向高度设置为横向高度的尺寸,并在其下方留出空白。

If I allow both orientations and go from portrait to landscape back to portrait it corrects itself. 如果我允许这两种方向,并且从纵向到横向再回到纵向,它都会自我校正。 If I click any link/button that transitions from one JQM page to another, it corrects itself. 如果我单击从一个JQM页面转换到另一个JQM页面的任何链接/按钮,它将对其进行纠正。 Though during transitions the whitespace at the bottom is noticeable, but then it does fill the full viewport. 尽管在过渡期间,底部的空白很明显,但随后确实填充了整个视口。

My workaround is to assign an id to the div that contains the content of the home page (id="home_content") and add the following code to the beginning of onDeviceReady(): $("#home_content").height($(window).height()); 我的解决方法是为包含主页内容的div分配一个id(id =“ home_content”),并将以下代码添加到onDeviceReady()的开头:$(“#home_content”)。height($( window).height());

Has anyone else seen this before? 有人看过吗? If so, I would appreciate any assistance in a better resolution. 如果是这样,我将为您提供更好的解决方案提供任何帮助。

Thanks, Sean 谢谢,肖恩

Sounds like a viewport issue. 听起来像是视口问题。 Do you have a 'viewport' meta tag? 您是否有“视口”元标记? I found that I needed to mess with it for JQM. 我发现我需要为JQM弄乱它。

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1/" >

More info https://developer.mozilla.org/en/Mobile/Viewport_meta_tag 更多信息https://developer.mozilla.org/en/Mobile/Viewport_meta_tag

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM