This question is more or less an exact duplite of:
Forcing a webpage to fit into a webview
But that is because the provided answer does not work.
So: I have a WebView that loads some HTML content. I need to shrink/zoom the content so that it fits the width of the WebView. The height of the WebView should adjust accordingly. The WebView is part of a larger layout that, in turn, is inside a ScrollView.
Even though I tried the following:
WebView webView = (WebView)findViewById(R.id.webView);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setLoadWithOverviewMode(true);
The web content is consistently too large for the WebView and I have a horizontal scroll bar in the WebView. The other part of the problem seems to work, i.e. the height of the WebView fits the content without a scroll bar and the size of the layout in the ScrollView is correct as well.
So, are there any other factors to consider? Is there anything that the HTML itself must "get right" for this to work?