Phonegap on Galaxy S3 ignores touch events

放肆的年华 提交于 2019-11-28 05:50:32

问题


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.

If I run this code

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 

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]

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);

回答1:


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.



来源:https://stackoverflow.com/questions/12862347/phonegap-on-galaxy-s3-ignores-touch-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!