Android 앱이 onDeviceReady
이벤트에 잘못된 크기 (320x480)를 반환하지만 몇 초 후에 크기가 올바르게됩니다.PhoneGap/Cordova Android가 onDeviceReady 이후 화면 크기를 얻습니다.
어떻게 처음부터 올바른 크기를 얻을 수 있습니까? 아니면 정확한 크기를 얻을 수있는 이벤트가 있습니까? 코르도바 2.5.0를 사용
<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" />
:
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];
}
뷰포트 :
나는 크기를 얻기 위해이 기능을 사용하고 있습니다.
UPD :
이 스크린 샷 응용 프로그램에서 볼 수 있듯이 더 작은 크기로 시작됩니다. 심지어 비어있는 코르도바 프로젝트도 이것을합니다. 이 문제를 어떻게 해결할 수 있습니까?
감사합니다!
그 문제의 진전 :
이 링크를 좀 더 작동 방법에 대한 세부 사항을 제공 ? 그 답 중 어떤 것도 나중에 일 했나요? – Fardin
문제가 있습니까? 진행 상황이 있습니까? – poordeveloper
불행히도 저는 더 이상 Cordova 응용 프로그램을 개발하지 않을 것입니다. 시간이 있다면 다음과 같은 솔루션을 재현하고 확인하려고 노력할 것입니다. 그러나 그것이 당신을 위해 작동하지 않는다면, 그것은 나에게는 도움이되지 않을 것입니다. – dymv