机器人的WebView:非常laggy按钮响应 [英] Android WebView: Very laggy button response

查看:106
本文介绍了机器人的WebView:非常laggy按钮响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小的web应用程序,我用Android的WebView功能功能的发挥。

I've got a little web app that I made to play with Android's WebView functionality.

我有我的按钮使用(与的onclick 属性)部分的div。当尝试应用程序(在设备的浏览器),我立刻攻一个按钮后,发现了大量的滞后。滞后来当我轻点按钮,并在浏览器中显示周围的橙色亮点之间吧。

I've got some divs that I use as buttons (with onclick attributes). Upon trying out the app (in the device's browser), I immediately noticed a huge amount of lag after tapping a button. The lag comes between when I tap the button and when the browser shows the orange highlight around it.

我做了一些测试,并得到了一些信息:

I did some testing and got some info:

  • 在JavaScript是没有问题的。我断开链接我所有的脚本和空白了所有的的onclick 属性。性能没有改变。
  • 在CSS3的东西是没问题的。我摆脱了所有花哨梯度,而且性能并没有改变。
  • 的元素的数目是没有问题的。我尝试了与页面上只有几个元素,而性能没有改变。
  • 文档类型和元的东西是没问题的。我确信我是用什么样的Andr​​oid 建议
  • JavaScript isn't the problem. I unlinked all my scripts and blanked out all the onclick attributes. The performance didn't change.
  • CSS3 stuff isn't the problem. I got rid of all the fancy gradients, and the performance didn't change.
  • The number of elements isn't the problem. I tried it with just a few elements on the page, and performance didn't change.
  • Doctype and meta stuff isn't the problem. I made sure I was using what Android recommends.

我真的很茫然,为什么有这么多的滞后。我已经消除了可能会造成这一切的,但什么也没有帮助。

I'm really at a loss as to why there's so much lag. I've eliminated everything that could be causing it, but nothing's helped.

我缺少的东西?

如何我可以删除滞​​后后挖一个按​​钮?

推荐答案

基本上,点击手机浏览器事件是由300毫秒延迟。你知道的快速键模式?基本上,你可以使用 touchstart 事件(其中火灾无延迟)。

Basically, click events on mobile browsers are delayed by 300ms. Do you know of the fast button pattern? Basically you can use the touchstart event (which fires without delay).

下面是一个完整的解释:<一href="http://$c$c.google.com/mobile/articles/fast_buttons.html">http://$c$c.google.com/mobile/articles/fast_buttons.html

Here's a complete explanation: http://code.google.com/mobile/articles/fast_buttons.html

这篇关于机器人的WebView:非常laggy按钮响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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