Reputation: 3
I am trying to scroll a webview based on volume click button I added following code first,
myWebView.scrollBy(0, 250);
this does scroll but then the scrolling is not smooth, view quickly alters, which is annoying. I tried adding a loop and a time delay, something like this
for(int i=-250;i<250;i++)
{
Thread.sleep(Math.abs(i/20));
myWebView.scroll(0,1)
}
For some strange reason this is not smooth either, the program waits for some delay and scrolling happens after that and that also is not controlled.
I tried scroller
Scroller sc= new Scroller(myWebView.getContext());
sc.startScroll(0, 0, 0, 250,250);
this didnt even scroll.
Is there any other way to get make it work? Or can there be some improvement in above code?
Upvotes: 0
Views: 466
Reputation: 2679
Hello did you try this method ?
webView.flingScroll (int vx, int vy)
you might find this question useful web view smooth scroll.
I hope it helps..
Upvotes: 1