Reputation: 1201
I am using a Webview to look at a local image with zoom support and all that. Is there any way that I can make the WebView zoom to only fit the height of the image, instead of the width like it does with my current code? Here is what I have:
WebView image = (WebView)findViewById(R.id.map);
image.getSettings().setBuiltInZoomControls(true);
image.getSettings().setLoadWithOverviewMode(true);
image.getSettings().setUseWideViewPort(true);
image.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT));
image.loadUrl("file:///android_asset/image.png");
Upvotes: 1
Views: 2909
Reputation: 8531
Try using the webView Settings
use the webSettings class
webview.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
Check out Set zoom for Webview
Update:
as setDefaultZoom
deprecated you need to use another settings
Upvotes: 2