Skip to content

Latest commit

 

History

History
66 lines (40 loc) · 2.76 KB

README.md

File metadata and controls

66 lines (40 loc) · 2.76 KB

NestedScrollingWebView

Nested Scrolling support for Android WebView


NestedScrollingWebView is-a WebView that implements NestedScrollingChild.

It is useful for purposes where WebView is required to be:

  1. Scrollable
  2. Zoomable
  3. Supporting nested scrolling

Example: Hiding the toolbar upon scroll (Issue-14991).

Why: There is no default way to reliably support all the 3 aforementioned behaviors as:

  • Using NestedScrollView interferes with the zoom (Issue-16135).
  • Intercepting the scale motion events from NestedScrollView and passing it to WebView is unreliable.
  • Hiding the toolbar by detecting scroll is unreliable.
  • Workarounds for ensuring reliable zoom behavior interferes with scrolling.
  • Methods allowing consistent scroll and zoom behavior are not reliable for hiding toolbar.

Usage: Refer the example app in the repo.

  1. WebView.setNestedScrollingEnabled must be set to true. (Example)
  2. XML: <com.deysak.nestedscrollingwebview.NestedScrollingWebView ... /> (Example)

Video:

(A) Infinite Scroll after zoom:

NestedScrollingWebView ✨
new-scroll.mp4
Bug 🐞
old-infinite-scroll.mp4

(B) Unreliable Zoom:

NestedScrollingWebView ✨
new-zoom.mp4
Bug 🐞 Notice that I am trying to zoom at start, but it isn't zooming in.
old-buggy-zoom.mp4

So far it has been only tested for the purpose of collapsible toolbar, while allowing for reliable zoom and scroll functionality.