Android アプリはイベントで無効なサイズ (320x480) を返しますonDeviceReady
が、数秒後に正しいサイズになります。
最初に正しいサイズを取得するにはどうすればよいですか? または、正しいサイズを取得できるイベントはありますか?
この関数を使用してサイズを取得しています:
function getWindowSizes() {
var windowHeight = 0, windowWidth = 0;
if (typeof (window.innerWidth) == 'number') {
windowHeight = window.innerHeight;
windowWidth = window.innerWidth;
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
windowHeight = document.documentElement.clientHeight;
windowWidth = document.documentElement.clientWidth;
} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
windowHeight = document.body.clientHeight;
windowWidth = document.body.clientWidth;
}
return [windowWidth, windowHeight];
}
ビューポート:
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
Cordova 2.5.0 を使用しています。
UPD:
このスクリーンショットでわかるように、アプリケーションは小さいサイズで起動します。空の Cordova プロジェクトでさえこれを行います。どうすればこれを修正できますか?
ありがとう!