onClick事件中的Andr​​oid的WebView太慢 [英] onClick event in android webview too slow

查看:227
本文介绍了onClick事件中的Andr​​oid的WebView太慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的感觉是,JavaScript的本身是pretty的速度快于Andorid的web视图,但有接触的元素,onclick事件beeing发射之间长时间的延迟。

I've got the feeling that javascript itself is pretty fast in an andorid webview, but there is a long delay between touching an element and the onclick event beeing fired.

我能想象,这是一个功能,如果你浏览网页之间 - 你第一次看到在元素上的亮点,然后就看到效果(导航)。但用于应用程序,这是太慢了。

I could imagine that this is a feature if you navigate between pages - you first see the highlight on the element, and then you see the effect (navigation). But for applications, this is too slow.

有没有办法来改变这种行为?

Is there a way to change this behavior?

或者是有,也许另外一个事件我应该去,像一个onHover或onTouch?这东西触发方式的onClick?

Or is there maybe another event I should go for, like an onHover or onTouch? Something which fires way before the onClick?

推荐答案

这是一个已知的问题关系到300ms以内,由于用户敲击/缩放在显示:

This is a known 'issue' related to 300ms due to user tapping/zooming at display:

http://updates.html5rocks.com/2013/ 12 / 300ms的抽头延迟,走了走

在不久的将来,这似乎可以解决,在静态尺寸的布局,在头标附加信息。但实际的WebKit的WebView版本没有/考虑这个选项。

In the near future, this seems to be solved, in static sized layouts, adding information at header. But the actual webkit webview version does not have/consider this option.

在我的情况下,该解决方案是使用Tappy lib目录下:

In my case, the solution was use Tappy lib:

https://github.com/filamentgroup/tappy

刚导入,并绑定到,有一个click事件的每个元素,你会看到其中的差别。

Just import it, and bind to each element that has an click event, and you will see the difference.

只是多说一点:我调整了定时器100000ms(默认值:1000毫秒),以避免在某些特定的情况下,事件的重复

Just one more point: I adjusted the timer to 100000ms (default:1000ms) to avoid event repetition in some specific cases.

这篇关于onClick事件中的Andr​​oid的WebView太慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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