0

I have an Android app that we've been developing for several years. At some point the scrolling in a WebView has gotten a bit wonky. It has to do with the "momentum" after swiping up or down. Sometimes the momentum will stop prematurely. Sometimes it will appear to bounce and backup a bit. I'm seeing this on multiple devices so I don't think it isa hardware issue.

The problem seems to happen both on external URLs that are loaded and with built-in HTML files (e.g. Help files).

This is a very plain WebView. I've commented out all the code that configures it or manages its WebViewSettings.

It seems it must have something to do with the app it is embedded in, possibly some manifest settings, but I can't imagine what.

Has anyone experienced anything like this?

btschumy
  • 1,435
  • 1
  • 18
  • 35

2 Answers2

1

Try setting the parent View of the Webview to

view.setFocusable(false);

I had a very similar issue involving scrolling a Webview that had a series of DIVs with images. When scrolling down it would spontaneously reverse scroll direction and even sometimes shoot back to the top. It only happened on hardware devices -- never on simulator or in any conventional browser I tested.

See Android reference here: https://developer.android.com/reference/android/view/View.html#setFocusable%28boolean%29

seanthomas
  • 41
  • 2
0

This issue is because of the default scroll behaviour of WebView. If you have a webview inside a ScrollView then, there will be cases where scroll event will be sometimes handled by the scroll view and sometimes by WebView and therefore the jitter during scroll.

In order to fix these scroll issues, please refer this Scrolling of Webview inside ScrollView

Saikrishna Rajaraman
  • 3,205
  • 2
  • 16
  • 29
  • The WebView is not in a ScrollView. It is inside a Fragment that is using a FrameLayout as it's top level container. – btschumy Aug 20 '18 at 19:18
  • I've experimented more with this. I created a WebActivity in my app that just has a totally generic WebView as its one element inside a LinearLayout. When I start this activity in my app, I get same wonky scrolling. This implies (to me) that it must be something about the app setup in the manifest. – btschumy Aug 21 '18 at 17:02