今天拿到一个小需求,涉及到动态设置WebView大小,刚开始考虑使用
mContentWebView.getSetting().setSupportZoom(true);
mContentWebView.getSetting().setTextSize(TextSize.Larger);
这种方法确实是可行的。
但是后来发现项目里json返回的直接就是html,大喜,就直接使用下面这种方法,效果如下图:

下面是代码:

调用方法如下:


今天拿到一个小需求,涉及到动态设置WebView大小,刚开始考虑使用
mContentWebView.getSetting().setSupportZoom(true);
mContentWebView.getSetting().setTextSize(TextSize.Larger);
这种方法确实是可行的。
但是后来发现项目里json返回的直接就是html,大喜,就直接使用下面这种方法,效果如下图:
下面是代码:
调用方法如下:
本文标题:Android动态设置WebView的字体大小
本文链接:https://www.haomeiwen.com/subject/pebjfxtx.html
网友评论