Sto scrivendo un'app Phonegap (3.2), prendo un canvas HTML5, lo faccio a schermo intero e l'intera interfaccia utente dell'app è su questa tela.Risoluzione dello schermo su un'app PhoneGap
Utilizzando un Samsung Galaxy S4 (Android 4.3) per testare l'app, la risoluzione dello schermo dell'app è solo 360X640 e non 1080X1920 come voglio che sia.
Cosa è necessario fare per rendere l'app utilizza la massima risoluzione dello schermo possibile?
schermate che ho aggiunto 1) // sembra ok, ma cattiva risoluzione
WindowWidth = window.innerWidth; windowHeight = window.innerHeight;
2) // Prende piccola parte dello schermo, resto è bianco
WindowWidth = window.outerWidth; windowHeight = window.outerHeight;
3) // Solo una piccola parte dell'immagine è visibile, come se l'immagine fosse 1080X1920 ma lo schermo è "troppo piccolo" per esso.
windowWidth = screen.width; windowHeight = screen.height;
e qui è il codice completo:
<!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>
Grazie.
Nizza. Ho completamente dimenticato di questo :) – K3N