Workaround:
Waiting for the html page to load and launch the internal JS page to determine the height of the content and set it in the WebView Layout settings.
Easy to run JS inside the page, just go to url like
javascript:Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight);
To pass the result to Java code, you must provide the Java-Java Script interface as described here https://developer.android.com/guide/webapps/webview.html (binding JavaScript code to Android code)
Your navigation url should look like
javascript:myfunc(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight));
Myfunc will be called and you will get the page height. Now just set the height to the height of the WebView.
Nik
source share