Search code examples
androidandroid-webviewdefault-valuefont-family

What is the default font family taken by android webview to show its fonts?


I am displaying my content on Webview as loadData method

  webview.loadData(WS.welcome_header_text,"text/html","UTF-8");

Here my WS.welcome_header_text =  <div style="text-align: center;"><span style="color: rgb(255, 255, 255); font-size: x-large; background-color: transparent;">Please share your feedback with us</span></div>

There is no font-family specified from my backend API but I want to know what font family is taken by my android web view as default.

enter image description here

When It shows Content "Please share your feedback with us" on the above screenshot.


Solution

  • WebView has provided us with the methods to check the default fonts like -

    1. webview.getSettings().getStandardFontFamily()
    2. webview.getSettings().getFixedFontFamily()

    and As WebView Safe fonts Suggested, My default fonts which are applying, I get it through StandardFontFamily(sans-serif) font-family in my case and Arial/Verdana fonts in particular.