This problem infuriated me. Let me assume: your content is not downloaded from the Internet or from the file system, and you are making a call to WebView.loadData() or WebView.loadDataWithBaseUrl() (where you specify null or an empty string in the latter case). Right?
If yes, then I probably have a solution for you that was inspired by this discussion : be sure to use the WebView.loadDataWithBaseUrl() method and provide baseUrl , which is not null , not an empty string and is different for different content data. According to the SDK documentation, baseUrl is only used to evaluate relative URLs within the data (for example, <img> tags that do not indicate the domain name in their src attribute), so if your data does not refer to external content, I think you can generate "virtual" urls (have not tried this).
It seems that the WebView looking at the URL and, if it does not change all subsequent calls to loadData... , will result in the same WebView height.
source share