I have an image and other elements (div, titles etc.) in my webview and i need only the image to zoom on click, like picture in gallery. Something like in this tutorial. but in webview. I only found, how to zoom whole webview.
You can use this.
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("file:///android_asset/images/yourimage.png");
webview.getSettings().setSupportZoom(true);
webview.getSettings().setBuiltInZoomControls(true);
Related
I had added a few images in webview and also have the zooming feature. but initially the webview is so small that a person cannot read the data of the images until he zooms to read it. so I just want to know how can I set webview initial zoom feature to a particular value
webView = (WebView) findViewById(R.id.phy_law_web);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.loadUrl("file:///android_asset/mathscribe/Analyticgeometry.html");
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
I have a web view and when it is loading URL, it is already zoomed in with some percentage. i.e. user has to scroll horizontally to see the entire content. I want to load the web page with minimum zooming size. i.e. user cannot be zoom out anymore at the time of loading. I tried below, but it is showing the entire page in the web view at once. ultimately I want to fit the web page horizontally.
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
Just use setMinimumFontSize and setUseWideViewPort(true) like below. (Y)
WebView wv = (WebView) findViewById(R.id.webview1);
wv.getSettings().setLoadWithOverviewMode(true);
wv.getSettings().setUseWideViewPort(true);
wv.getSettings().setMinimumFontSize(35);
I'm using WebView as an image viewer in my android application.
The image size is 750X3500 and I need to view the whole image, i.e. I want the maximum zoom out in order the image fit the screen.
It seems to me like impossible mission so far :(
Here is my WebView initialization code:
WebSettings webSettings = mWebView.getSettings();
webSettings.setLoadsImagesAutomatically(true);
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setDefaultZoom(ZoomDensity.FAR);
mWebView.getSettings().setLoadWithOverviewMode(true);
mWebView.getSettings().setUseWideViewPort(true);
mWebView.getSettings().setJavaScriptEnabled(true);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
And here is a sample image:
http://linkpeek.com/m/vault/c/8/3/c835da21e9d3bd65359d024d0feff30f4eb77cacccf6e477bc9fbb52848984cf.png
Any idea guys?
Thanks.
If you use an HTML page to load the image, then you can use "viewport" HTML meta to control how it displays and zooms.
I cannot seem to get the Android webview to zoom in or out for mobile sites like:
http://m.bbc.co.uk
The webpage just comes out in a single column.
I tried:
I have tried different permutations (true/false) with
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setLoadWithOverviewMode(true);
I have also tried to
WebView.getSettings().setSupportZoom(true);
WebView.getSettings().setBuiltInZoomControls(true);
but it is still not working for me.
have you tried setBuiltInZoomControls
WebView.getSettings().setBuiltInZoomControls(true);
I'm using the following code which only zooms the loadData. How is it possible to zoom the image inside? Thank you in advance!
WebView web = (WebView) findViewById(R.id.myid);
web.loadUrl("file:///android_asset/image.jpg");
web.getSettings().setBuiltInZoomControls(true);
web.setBackgroundColor(0);
web.setVisibility(ImageView.VISIBLE);
web.setBackgroundResource(R.drawable.myimage);
I finally did it by insersting the image.jpg in an html file which took the place of loadUrl().