I want to have only vertical scrolling in my webview and don't want any horizontal scrolling.
webSettings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); helped me to solve the scrolling issue
But using this made my webview looking wierd. Height of all the edit text squeezed (Vertically) and is looking bad.
Q.1) Is there any other way I can disable horizontal scrolling from client side?
Q.2) Using SINGLE_COLUMN how can we avoid issue with webview height changes? I want the vertical look and feel to be same as what it used to be without SINGLE_COLUMN
解决方案
This is a hack, but one that has worked for me successfully in the past. Surround your WebView in a vertically oriented ScrollView:
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical" >
android:id="@+id/mywebview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
and then disable all scrolling in your WebView.
To disable your WebView's scrolling, you can use this code:
// disable scroll on touch
webview.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
return (event.getAction() == MotionEvent.ACTION_MOVE);
}
});