开发者

Unexpected scroll on single touch after panning in Android WebView

开发者 https://www.devze.com 2023-04-06 06:11 出处:网络
I have extended WebView and I have enabled zooming with myWebView.getSettings().setSupportZoom(true);.

I have extended WebView and I have enabled zooming with myWebView.getSettings().setSupportZoom(true);.

When I tap the screen (single tap/touch) after I have panned, the WebView seems to move (scroll) to an other positi开发者_运维百科on. This messes up my panning and double tap events, because the coordinates change unexpectedly.

Is there a way to prevent this? Android version is 2.3.


The root cause seems to be that the onScroll event is fired.

I've found a workaround by setting a boolean to false in every method (except onScroll) of my class that extends SimpleOnGestureListener, and then checking that boolean in onScroll. If it's false, then I return true to indicate that the event has been consumed.

0

精彩评论

暂无评论...
验证码 换一张
取 消