【问题标题】:Jelly Bean webview app does not respond to touchend events perfectlyJelly Bean webview 应用程序无法完美响应 touchend 事件
【发布时间】:2012-09-04 02:29:20
【问题描述】:

我的 webview 应用程序在比 Jelly Bean 更早的 android 版本中可以正常处理 touchend 事件。但是在 Jelly Bean 中,touchend 事件是不可靠的。特别是在可滚动的 div 上,有时不会触发 touchend 事件,整个应用程序停止响应任何 touchend 事件,我收到带有标签“webcoreglue”和文本“不应该发生:没有基于 rect 的测试节点”的日志消息成立” 现在,在我滚动一点之后,它开始正常响应 touchend。 请帮忙。

HTML

<div id="srpanel" class="panel">
    <div class="main sr-list">
        <div class="sr-list-item-action">
        </div>
    </div>
</div>

JS

$('.sr-list-item-action').bind('touchend', function(){
//some code
});

我在 for 循环中为列表中的每个项目使用 div 'sr-list-item-action'。 因此,单击列表中的某个项目仅在某些情况下有效。否则,当它不起作用时,整个屏幕实际上会被冻结并停止接收任何 touchend 事件,直到我滚动为止。 我观察到的另一件事是,当我转到列表的下一页时,当我执行$(document).scrollTop(); 时,这种情况发生得更多。不确定这是否相关。

【问题讨论】:

    标签: android-webview android-4.2-jelly-bean


    【解决方案1】:

    遇到了完全相同的问题。经过许多不眠之夜,这救了我:

    window,html,body {
        overflow-x:hidden !important;
        -webkit-overflow-scrolling: touch !important;
        overflow: scroll !important;
    }
    

    【讨论】:

      【解决方案2】:

      在绑定中将所有“touchend”更改为“click”。这对我有用。 这个链接很有帮助:Android WebView JellyBean -> Should not happen: no rect-based-test nodes found

      【讨论】:

      • 在那个链接中,得到赏金的答案(你在哪里读到“点击”)是我的 :) 我也这样做了,它在大多数情况下确实有效,但是有一个它不起作用的特殊情况。
      • 我没有意识到这一点哈哈:)。顺便感谢您的解决方案。
      猜你喜欢
      • 2017-08-04
      • 1970-01-01
      • 2017-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-23
      • 2014-08-22
      • 1970-01-01
      相关资源
      最近更新 更多