Reputation: 7191
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:
This is possible to block zoom out?
And I want avoid zoom out to this scale:
Upvotes: 1
Views: 747
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