Issue
In my application I am using webview. I want to change font size in webview,so I am doing it as:
WebSettings webSettings = webView.getSettings();
webSettings.setDefaultFontSize(25);
But it does not reflect text size change. I also tried using
loadUrl("javascript:(document.body.style.fontSize ='25pt');");
But still no luck. If I change .css file as
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 25px;
color: #495A69;
background-color: #fff;
padding: 0 16px 16px;
}
Then it works. But I want to change Text size at runtime, Therefore I cant use this working css file. Any suggestion will be appreciated. Thanks in advance.
Solution
Use this to zoom the text size
WebSettings settings = mWebView.getSettings();
settings.setTextZoom(settings.getTextZoom() + 10);
or use
WebSettings settings = mWebView.getSettings();
settings.setTextSize(WebSettings.TextSize.LARGER);
Answered By - Fahim
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.