安卓:设置web视图一个可读的字体大小 [英] Android: Set a readable font size for webView

查看:128
本文介绍了安卓:设置web视图一个可读的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用web视图来显示HTML内容。
文字大小是可读的平板电脑。但是小的智能手机,文本显示为点。用户必须捏缩放阅读。
有没有什么办法来设置一个固定大小,这将是在两个平板电脑和智能手机?

可读
解决方案

  WebSettings WS = webView.getSettings();


  • setTextSize:

    ws.setTextSize(ws.TextSize.NORMAL);


枚举指定文本大小。
SMALLEST 50%,
SMALLER 75%,
正常值为100%,
放大为150%,
LARGEST 为200%,


  • 或者用这个

    ws.setDefaultFontSize(12);


I'm using webView to display HTML content. The text size is readable for tablets. However on small smartphones, the text appears as dots. The user has to pinch-zoom to read it. Is there any way to set a fixed size which will be readable on both tablets and smartphones?

解决方案

WebSettings ws= webView.getSettings();

  • setTextSize:

    ws.setTextSize(ws.TextSize.NORMAL);

Enum for specifying the text size. SMALLEST is 50%, SMALLER is 75%, NORMAL is 100%, LARGER is 150%, LARGEST is 200%,

  • Or use this one

    ws.setDefaultFontSize(12);

这篇关于安卓:设置web视图一个可读的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆