To enable scaling in the webView, add the following code to the onTuchEvent override method:
webview.getSettings().setBuiltInZoomControls(true); webview.getSettings().setSupportZoom(true);
If your webview goes to a different URL and you want to keep the zoom level use the webSettings class
webview.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
If you want the preset zoom to be used when loading webview :
mWebView.setInitialScale(ZOOM_LEVEL);
This works well for all device resolutions.
UPDATE: If any of these work (weeeird ...), try the following:
public class Main extends Activity { private WebView myWebView; private static final FrameLayout.LayoutParams ZOOM_PARAMS = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT,Gravity.BOTTOM); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.webview); this.myWebView = (WebView) this.findViewById(R.id.webView); FrameLayout mContentView = (FrameLayout) getWindow(). getDecorView().findViewById(android.R.id.content); final View zoom = this.myWebView.getZoomControls(); mContentView.addView(zoom, ZOOM_PARAMS); zoom.setVisibility(View.GONE); this.myWebView.loadUrl("http://www.facebook.com"); } }
From this question.
source share