user1302569
user1302569

Reputation: 7191

webView and zoom bounds

I have a problem with bounds of zooming in webview. This is code my webView:

    WebView web = new WebView(getContext());
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setBuiltInZoomControls(true);

String imagePath = id;
String html = "<html><body style='margin:0;padding:0;'><img src=\""+ imagePath + "\" height=\""+ height + "\"width=\""+ width+ "\"></body></html>";
web.loadDataWithBaseURL("file:///mnt/sdcard/DinEgen/", html, "text/html","utf-8","");
web.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
web.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
web.clearView();
web.clearCache(true);

I would like to know that is possible to do that when I start application I can only zoom in and when I back I can only zoom out to size from start. This is zoom in:enter image description here

This is possible to block zoom out? And I want avoid zoom out to this scale:enter image description here

Upvotes: 1

Views: 747

Answers (1)

throrin19
throrin19

Reputation: 18197

yes, you could stop zoom and adapt this to the screensize by adding the following line in the header of your html :

<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" />

Upvotes: 4

Related Questions