简体   繁体   中英

Android: Set a readable font size for webView

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM