I have a site built on top of PrimeFaces. My problem is that the content and images in WebView are larger than in Chrome. What to do to render rendering on WebView identical to rendering in the Chrome browser?
Scaling does not seem to help, because the website has a responsive design. I also tried wrap_content instead of fill_parent with no success.
Update 1 : The following steps are not affected. I excluded them from the code below to keep it minimal.
WebViewClientChromeViewClientsetLoadWithOverviewMode(true)setUseWideViewPort(true)
Update 2 : setInitialScale() has no effect.
MyActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); webView = (WebView) findViewById(R.id.web_engine); webView.setWebViewClient(new WebViewClient()); webView.getSettings().setJavaScriptEnabled(true); if (savedInstanceState == null) { webView.loadUrl("http://www.primefaces.org/showcase/mobile/index.xhtml"); } }
main.xml
<RelativeLayout xmlns:a="http://schemas.android.com/apk/res/android" a:layout_width="fill_parent" a:layout_height="fill_parent" a:background="#ffffff" a:orientation="vertical" > <WebView a:id="@+id/web_engine" a:layout_width="fill_parent" a:layout_height="fill_parent" />


source share