我需要能够把捏缩放和关闭使用视口设置在我的Android PhoneGap的应用程序。
I need to be able to turn pinch-zoom on and off using the viewport setting on my Android PhoneGap app.
但我无法得到视影响捏缩放在所有使用PhoneGap的时候。 我无法打开捏放大PhoneGap的,但与Android原生浏览器的网页浏览一切时工作正常。
But I'm unable to get viewport to affect pinch-zooming at all when using PhoneGap. I cannot turn on Pinch-zoom in PhoneGap, but when browsing with the Android Native browser to the webpage everything works fine.
我花了很多时间寻找解决的办法,没有任何结果。
I have spent a lot of time searching for a solution, without any result.
我创建了一个非常简单的index.html进行测试,其视设定,如:
I created a very simple index.html for testing, having viewport setting like:
<meta name="viewport" content="user-scalable=yes" />
由于一些曾建议我也曾尝试视窗:
As some has suggested I have also tried the viewport:
<meta name="viewport" content="user-scalable=1" />
对于Android PhoneGap的其他解决办法是使Android原生捏缩放已建议在这里: 放大的PhoneGap为Android 但是,这不会为我工作,因为我需要能够从JavaScript控制捏变焦。即我需要能够使用JavaScript来改变视区设置,以控制当捏变焦可用(用户可伸缩=是/用户可扩展=无)
Other solutions for Android PhoneGap would be to enable Android Native Pinch-Zoom which have been suggested here: zoom in phonegap for android But this will not work for me, since I need to be able to control the pinch-zoom from javascript. I.e. I need to be able to use javascript to change the viewport setting, to control when pinch-zoom is available (user-scalable=yes / user-scalable=no)
请注意,像初始规模和目标densitydpi等视口设置似乎很好地工作。例如,设置初始规模= 2开始该应用缩放。
Please observe that other viewport settings like "initial-scale" and "target-densitydpi" seems to work fine. For example setting initial-scale=2 starts the app zoomed.
(我目前正在测试捏变焦在PhoneGap的1.4.1和HTC Desire HD的安卓2.3.3)
(I'm currently testing pinch-zoom on PhoneGap 1.4.1 and HTC Desire HD Android 2.3.3)
我开始觉得我错过了一些东西很明显,因为我找到类似的问题,资料太少......
I'm beginning to think I have missed something obvious, since I find so little information about similar problems...
最小的index.html:
The minimal index.html:
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="user-scalable=yes" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Minimal AppLaud App</title>
<script type="text/javascript" charset="utf-8" src="phonegap-1.4.1.js"></script>
<script type="text/javascript" charset="utf-8">
var onDeviceReady = function() {
document.getElementById("devready").innerHTML = "OnDeviceReady fired.";
};
function init() {
document.addEventListener("deviceready", onDeviceReady, true);
}
</script>
</head>
<body onload="init();" id="stage" class="theme">
<h2>Minimal AppLaud App</h2>
<p> LOTS OF TEXT WHICH HAVE BEEN REMOVED HERE </p>
<p><span id="devready">onDeviceReady not fired.</span></p>
</body>
</html>
鸭preciate任何想法,你可能有!
Appreciate any ideas that you might have!
我有完全一样的问题,除了测试不同的视口的设置,我试图从这个建议:Pinch放大的Android与PhoneGap的和jQuery Mobile的但我不能让它工作(测试上三星Galaxy SII,安卓4.0.3)。然而,其他人报告了使用从链接的提示成功捏变焦。希望它可以帮助你!
I have exactly the same issue and besides testing different viewport settings, I have tried the suggestions from this: Pinch Zoom in Android with Phonegap and jQUERY Mobile but I can't make it work (testing on Samsung Galaxy SII, Android 4.0.3). However, others have reported successful pinch-zooming using the tips from the link. Hope it helps you too!