當用戶從橫向旋轉到縱向時,我正在遇到android phonegap應用程序出現的奇怪問題,但不是其他方式。Phonegap/HTML5和Android屏幕調整大小問題從橫向到縱向旋轉
當屏幕從橫向旋轉到縱向時,內容視口的高度似乎保持在先前的高度 - 但視口的寬度正確調整大小。以下圖片試圖表明這一點更爲清晰:
旋轉到
我看到了這樣一個問題:Android Screen Orientation: Landscape Back to Portrait ......但在接受的答案可能真的,我不完全知道什麼是被問到那裏。
我只有一個佈局/ main.xml中攜帶的默認配置:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
我也試圖把一些方向檢測腳本來看看是否有幫助 - 我已經試過:
var viewPortHeight = $(window).height();
alert (viewPortHeight+" x "+$(window).width());
var headerHeight = $('div[data-role="header"]').height();
var footerHeight = 0;
var contentHeight = viewPortHeight - headerHeight - footerHeight;
// Set all pages with class="page-content" to be at least contentHeight
$('div[class="page-content"]').css({'min-height': contentHeight + 'px'});
也
var devInfo = new DeviceInformation();
devInfo.setOrientation(0);
time_column_count = Math.floor(viewport.height/270);
devInfo.setResolution({
height : $(window).width(),
width : $(window).height()
});
但 - 沒有骰子。這裏的任何想法?
UPDATE
這隻似乎是ICS設備的問題 - 實際上有在橫向模式下對遇到此問題的設備滾動的問題。 JQM Scroll正用於啓用不同div的滾動功能。
你有沒有嘗試添加android:layout_weight =「1」到根視圖?好像它的佈局問題.. – Tom 2012-07-08 08:36:51
這似乎沒有做任何事情......它真的很奇怪,它只發生在ICS ... – Kaiesh 2012-07-09 10:22:08