kamydeep
kamydeep

Reputation: 133

Content is Scrollable or not in WebView in Android

How to know Content is Scrollable or not in WebView in Android. I have some conditions based on that, Is there any method? Thanks in Advance. I have seen onScrollChanged() and onOverScrolled() method it's called when we touch on the screen, but I need without it.

Upvotes: 2

Views: 292

Answers (2)

kamydeep
kamydeep

Reputation: 133

I have found the solution

override 
fun onPageFinished(view: WebView?, url: String?) {
super.onPageFinished(view, url)
if (computeVerticalScrollRange()<=computeVerticalScrollExtent()) {
         // logic here.... 
   }
}

Upvotes: 1

Tiko
Tiko

Reputation: 851

You can use the following View methods:

public boolean canScrollHorizontally(int direction)
public boolean canScrollVertically(int direction)

direction – Negative to check scrolling up/left, positive to check scrolling down/right.

Upvotes: 0

Related Questions