WebView in ICS touch events not being fired properly

倖福魔咒の 提交于 2019-12-04 05:51:55

问题


In ICS webview (which is compatible with older versions like 2.3.3) I am loading html file and wrote some functions which are linked with touch events like touchmove and touchend in javascript. But the problem in ICS is clicks on device is not recognized some times and no error in logcat even, can someone has work around for this problem? Thanks in advance.


回答1:


It could be your device treat them as mouseevents. (sucks...)

I am facing a similar problem. I am not sure if it's the problem of my tablet or it's a general problem for ICS default browser/webview.

Test the following thing.

  1. Write the html/js without jquery/plugin:
    • bind some functions to mouseevents (mousedown/mousemove/mouseup) and touchevents (touchstart/touchmove/touchend/touchcancel) to trace them
    • So, you can trace if you mousedown/mousemove/mouseup/touchstart/touchmove/touchend the webpage
    • upload the webpage to the web
  2. Now, use different devices to test the webpage.
    • Using PC (any browser), it should be traced as mouseevents
    • Using i-device, it should be traced as touchevents
    • Using Android 2.3.X (any browser), it should be traced as touchevents
  3. Try it with ICS. Here is my problem:
    • Using Android ICS' Chrome browser, it is traced as touchevents. (Fine)
    • Using Android ICS' default browser, it is traced as mouseevents. (What The!!)

Even worse, in my ICS device (default browser):

  • The touchevents are never fired in my ICS' default browser. If I touch the webpage, it shows mousedown/mousemove.
  • The devices do support creating touchevents (document.createEvent), which is a lie.
  • The mouseevents sequences are not completed. So, even if my code supports both mouseevents and touchevents, the mouseevent functions still cannot support this ICS device.


来源:https://stackoverflow.com/questions/11390902/webview-in-ics-touch-events-not-being-fired-properly

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