Sadeq Shajary
Sadeq Shajary

Reputation: 437

Change font size in all tabs in WebView android pager

I have 3 tabs in my activity and an icon for increase font size. In each tab, I have a webView and this is possible to increase font size with increase webView.getSettings().setDefaultFontSize(fontsize);.

But when I change tab, other tabs still have previous font size. how I can change 3 tabs font sizes simultaneous? and remain new size?

Upvotes: 1

Views: 65

Answers (1)

Ahmad Aghazadeh
Ahmad Aghazadeh

Reputation: 17131

You can use CSS. Save file in asset folder : styles.css

* {
    font-size: 100%;
  }

    htmlData = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />" + htmlData;
   // lets assume we have /assets/style.css file
    webView.loadDataWithBaseURL("file:///android_asset/", htmlData, "text/html", "UTF-8", null);

Upvotes: 0

Related Questions