Set zoom for Webview

Solution 1:

this will be applicable in this scenario i believe

mWebView.setInitialScale(ZOOM_LEVEL);

where ZOOM_LEVEL for example can be 25 for 25% 150 for 150%

Solution 2:

use the webSettings class

webview.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);

Notice that although webSettings is available since API Level 1, WebSettings.ZoomDensity is available since API Level 7. Works well for all device resolutions.

Also, in order to enable zoom on the webView, add the following code:

webView.getSettings().setBuiltInZoomControls(true);

Solution 3:

setDefaultZoom is deprecated.

webview.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);

So instead of that you can use like below,

webview.setInitialScale(1);
webview.getSettings().setLoadWithOverviewMode(true); 
webview.getSettings().setUseWideViewPort(true);

This help you to remove

setDefaultZoom(WebSettings.ZoomDensity.FAR).

Solution 4:

Before you leave the first page, use

int scale = 100 * webView.getScale();

Then after you load the second page, use

webView.setInitialScale( scale );