Bilbo Baggins
Bilbo Baggins

Reputation: 3692

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?

Upvotes: 1

Views: 4905

Answers (1)

Sagar
Sagar

Reputation: 1262

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

Upvotes: 1

Related Questions