Until now I have been an iPhone developer only and now I have decided to give Android a whirl. Something I haven't been able to figure out on Android is how to programmatically prevent scrolling in a WebView
?
Something similar to iPhones prevention of the onTouchMove
event would be great!
Just use
android:focusableInTouchMode="false"
on your webView.I resolved the flicker and auto-scroll by:
However if it still does not work for some reason, simply make a class that extends WebView, and put this method on it:
I am suggesting to extend WebView, in order to provide more effective control, like disable/enable swipes, enable/disable touches, listeners, control transitions, animations, define settings internally so on..
studying the above answers almost worked for me ... but I still had a problem that I could 'fling' the view on 2.1 (seemed to be fixed with 2.2 & 2.3).
here is my final solution
If you subclass Webview, you can simply override onTouchEvent to filter out the move-events that trigger scrolling.
I don't know if you still need it or not, but here is the solution:
Set a listener on your WebView: