PhoneGap(3.2)アプリケーションを作成しています。私はHTML5キャンバスを使ってフルスクリーンにして、このキャンバスにアプリケーションUI全体を表示します。PhoneGapアプリケーションの画面解像度
アプリをテストするためにSamsung Galaxy S4(Android 4.3)を使用すると、アプリの画面解像度は360X640であり、1080X1920ではありません。
可能な最大画面解像度をアプリで使用するためには、何が必要ですか?私はスクリーンショット 1を追加しました
)//はOK悪い解像度
windowWidth = window.innerWidthを検索します。 windowHeight = window.innerHeight;
2)//画面の小さな一部をとり、残りはwindowWidth = window.outerWidth
白色です。 windowHeight = window.outerHeight;

3)//画像が1080X1920であるように見えますが、画面が「小さすぎます」と表示されます。
windowWidth = screen.width; windowHeight = screen.height;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>PhoneGapTesting</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<!-- -->
<script type="text/javascript">
var windowWidth;
var windowHeight;
var canvasMain;
var contextMain;
var backgroundImage;
$(document).ready(function() {
windowWidth = window.innerWidth;
windowHeight = window.innerHeight;
//windowWidth = window.outerWidth; // Only 'window.innerWidth' + 'window.innerHeight' look OK but not max resolution
//windowHeight = window.outerHeight;
//windowWidth = screen.width;
//windowHeight = screen.height;
canvasMain = document.getElementById("canvasSignatureMain");
canvasMain.width = windowWidth;
canvasMain.height = windowHeight;
contextMain = canvasMain.getContext("2d");
backgroundImage = new Image();
backgroundImage.src = 'img/landscape_7.jpg';
backgroundImage.onload = function() {
contextMain.drawImage(backgroundImage, 0, 0, backgroundImage.width, backgroundImage.height, 0, 0, canvasMain.width, canvasMain.height);
};
$("#canvasSignatureMain").fadeIn(0);
})
</script>
</head>
<body scroll="no" style="overflow: hidden">
<center>
<div id="deleteThisDivButNotItsContent">
<canvas id="canvasSignatureMain" style="border:1px solid #000000; position:absolute; top:0;left:0;"></canvas><br>
</div>
</center>
</body>
</html>
ありがとう:ここ
と は完全なコードです。
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
var pixelRatio = window.devicePixelRatio || 1; /// get pixel ratio of device
canvasMain = document.getElementById("canvasSignatureMain");
canvasMain.width = windowWidth * pixelRatio; /// resolution of canvas
canvasMain.height = windowHeight * pixelRatio;
canvasMain.style.width = windowWidth + 'px'; /// CSS size of canvas
canvasMain.style.height = windowHeight + 'px';
(またはCSSルールの絶対値):
ニース。私はこれについて完全に忘れてしまった:) – K3N