I am using webview
to load the responsive website but it shows the width outside to the mobile size.
I open the link in a mobile Chrome browser and it looks good...
I mean to say the width does not fit to screen size of mobile; it shows out of width.
I am also using these... for <viewport>
tag for controlling its presentation.
WebSettings settings = webview.getSettings();
settings.setJavaScriptEnabled(true);
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
Also I am using setInitialScale for webview render properly.
webview.setInitialScale((int) 1.0);
but I am getting the website load not responsive as according to size... it shows the width is outside to screen size... which comes with scroll
Application works fine in Lollipop, Marshmallow etc. But does not work in Jellybean etc.
But the Link works well with latest chrome in all devices but does not work in webview
.
I also set this....
<meta name="viewport" content="width=device-width, initial-scale=1">
Screenshot
For most people, the 3G or 4G mobile network connection on their phone is much slower than their home or office wifi network. With that in mind, if your website relies on large images, which haven't been compressed for the web and take a few seconds to load on your computer, they may not load at all on your phone.
Let's state the obvious to begin with. The number one reason why your website might be failing to work on a mobile device is that it is simply not mobile responsive. This means the website doesn't proportionally resize to different size screens.
Try This:
WebView browser = (WebView) findViewById(R.id.webview);
browser.getSettings().setLoadWithOverviewMode(true);
browser.getSettings().setUseWideViewPort(true);
web.setInitialScale(1);
web.getSettings().setLoadWithOverviewMode(true);
web.getSettings().setUseWideViewPort(true);
try this code may be solve your issue.
is your web view layout_width="match_parent"?
you can also use:`
setting.setBuiltInZoomControls(true);
webView.setWebViewClient(new WebViewClient());
webView.setWebChromeClient(new WebChromeClient());
before:
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With