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);
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 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);
I have an HTML page which I downloaded (save as) in my computer. I loaded the same in the android asset folder and in the webview, i was trying to load the saved HTML page. The HTML page is not fitting in the webview properly. I used the following code:
WebView webView = new WebView(this);
setContentView(webView);
//Enable Java scripts
// webView.getSettings().setJavaScriptEnabled(true);
// webView.setInitialScale(100);
//webView.getSettings().setDefaultZoom(ZoomDensity.FAR);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);
//webview.setInitialScale(100); No need for this one
WebSettings settings = webView.getSettings();
settings.setBuiltInZoomControls(false);
Now, I had referred many stackoverflow discussions but, none of them helped. The width of the web page is fitting, however, the height is not. There are lots of blank spaces below the page which i loaded. The layout xml is as below:
<WebView
android:id="#+id/web"
android:layout_width="match_parent"
android:layout_height="fill_parent"/>
I tried to call the website directly from chrome in my android device and the web page is brilliantly fit in the screen. But, the same in the web view is not.
I tried to open the saved html page in HTML viewer and the same happens. Whats the difference here? Please can someone help me on how to fit the web page in the view? Why is there a difference ONLY in the height of the page?
Regards,
Hari
in my app i am trying to load a webpage. The webpage contains an image. I want the image to be exactly within the android device screen size. I want the image to be fitted to the evice.
In the web contents we have added the view port tag. I have loaded the URL in default browser of the device,the web page looked to be fitted in 2.1 but in 2.2 version the image seems to be very large. So i loaded the URL in a web view as follows
webView = (WebView)findViewById(R.id.webView1);
WebSettings webSettings = webView.getSettings();
webSettings.setUseWideViewPort(true);
webView.setInitialScale(30);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://xxxxxxxxxxx/get_ban/3");
Now the image is looking good in 2.2 version and in 2.1 it looks very small.
I want the image to be fitted to the screen size common for all the os version, how to do this......
try to use this
setLoadWithOverviewMode(true);
Is it the effect?
Try to use it with
setUseWideViewPort(true);
Everytime I load a page in the webview, the webview tries to squash the web page into a small frame. However, in the standard android browser, it loads the page at the full size and allows the user to zoom in however much they decide.
Is there anyway to make a webview load a page like the default web browser?
Something like this:
WebView wv;
WebSettings webSettings = wv.getSettings();
webSettings.setBuiltInZoomControls(true); //when you define webview settings just add this to enable zoom
wv.setInitialScale(1); //lets set initial zoom to 1% to see whole page when it loads