I have a webview with layout_height = "wrap_content". If you increase the default font size, the height of the web view increases. But if I reduce the default font size, then the height of the webview will not decrease. Thus, there was an empty spot at the bottom.
I tried the following trick:
articleContent.getSettings().setDefaultFontSize(fontSize); RelativeLayout.LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.BELOW, subtitleTextView.getId()); articleContent.setLayoutParams(layoutParams);
But it did not help. I know there is a way to fix this by re-creating the WebView with the code when I change the default font size, but in my situation I cannot do this. I need to save the webview because there are some views, and I cannot recreate them either.
source share