In my application I use a ScrollView. This ScrollView contain many Webview.
I change the webview font size:
webView.getSettings().setTextSize(WebSettings.TextSize.LARGER);
after I change again the font size:
webView.getSettings().setTextSize(WebSettings.TextSize.SMALLER);
The font size is changing, but the webview layout height is not changing. The text is smaller and there are a big space.
There are any method to this problem?
you might have to reload your webview with ie:
webview.loadUrl( "javascript:window.location.reload( true )" );
I had the same problem and fixed it using code:
private void reloadWebView() {
postDelayed(new Runnable() {
@Override
public void run() {
clearView();
requestLayout();
}
}, 10);
}
Call it method when You have finished zooming. It will refresh web view and recalculate it size.
You can use this:
myWebView.loadUrl("about:blank");
private void reloadWebView() {
// TODO Auto-generated method stub
postDelayed(new Runnable() {
@Override
public void run() {
clearView();
reload();
myWebView.getSettings().setJavaScriptEnabled(true);
requestLayout();
}
}, 10);
}