Reputation: 1787
I've a webview that I want to load a website and when I load it, it doesn't go right and left. It just goes up/down. (pan/scroll actions)
This is the code:
WebView wb=(WebView)findViewById(R.id.webView1);
WebSettings settings = wb.getSettings();
settings.setDefaultTextEncodingName("utf-8");
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
settings.setSaveFormData(false);
settings.setSupportZoom(true);
Thanks.
Upvotes: 1
Views: 1479
Reputation: 3791
You can achieve that with:
settings.setUseWideViewPort(true);
But you should read more about it in Android SDK Documentation:
public synchronized void setUseWideViewPort (boolean use)
Added in API level 1 Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport.
When the value of the setting is false, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels.
When the value is true and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used.
Parameters
use whether to enable support for the viewport meta tag
More info @ http://developer.android.com/reference/android/webkit/WebSettings.html#setUseWideViewPort(boolean)
Upvotes: 3