Galaxy S3上的Phonegap忽略触摸事件 [英] Phonegap on Galaxy S3 ignores touch events

查看:188
本文介绍了Galaxy S3上的Phonegap忽略触摸事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很奇怪的问题。我有一个PhoneGap 2.0应用程序,基本上完成。它在iPhone和iPad上的工作,我将它移植到Android一天,测试它在我的Galaxy S.一切工作完美。然后我试图运行它在我的全新的S3,没有一个触摸事件工作。

I am having a really odd issue. I have a Phonegap 2.0 app that is basically completed. It is working on iPhone and iPad and I ported it over to Android in a day, testing it on my Galaxy S. Everything worked perfectly. Then I tried to run it on my brand new S3 and none of the touch events worked. Clicks work, but not touch.

如果我运行此代码

document.addEventListener('touchstart', function (e) { console.log('touch start')}, false);
document.addEventListener('click', function (e) { console.log('doc click'); }, false);

...只有点击事件日志。如果我注释掉了点击,我得到的只是系统的点击。

... only the click events logs. If I comment out the click I get nothing but the system clicks.

10-12 10:08:16.213: V/webview(2805): NO_FAST_DRAW = false
10-12 10:08:16.283: V/webview(2805):  singleCursorHandlerTouchEvent -getEditableSupport  FASLE 

真奇怪的是,同样的touchstart在S3浏览器和PhoneGap ChildBrowser插件上都可以工作。

The really weird thing is that the same touchstart works both on the S3 browser AND the PhoneGap ChildBrowser plugin. Just not in the webview portion of the app, and only on the S3.

[UPDATED]

[UPDATED]

而且在应用程式的webview部分,它得到weirder。如果我在内联JavaScript代码中绑定事件,例如

And it gets weirder. If I bind the event in the inline JavaScript code, such as this

// Javascript stuff
document.addEventListener('touchstart', function (e) { alert('touch start')}, false);
// more JavaScript stuff

它实际上是可行的。但是,如果我在超时后设置它不会

it actually works. However, if I set it after a timeout it doesn't

setTimeout(function() {
    document.addEventListener('touchstart', function (e) { alert('touch start')}, false);
}, 2000);


推荐答案

我很伤心地说, Ice Cream Sandwich不支持触摸事件(http://stackoverflow.com/questions/11390902/webview-in-ics-touch-events-not-being-fired-properly)。所以iOS支持touch *事件,Galaxy S支持touch *和mouse *,Ice Cream Sandwich(S3)不支持touch *。 Egads。我希望我错了。

I'm very sad to say, it looks like Ice Cream Sandwich does not support touch events (http://stackoverflow.com/questions/11390902/webview-in-ics-touch-events-not-being-fired-properly). So iOS supports touch* events, Galaxy S supports touch* and mouse* and Ice Cream Sandwich (S3) does not support touch*. Egads. I hope I'm wrong.

这篇关于Galaxy S3上的Phonegap忽略触摸事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆