How to change font face of Webview in Android?

前端 未结 14 1299
北荒
北荒 2020-11-22 12:23

I want change the default font of webview to a custom font. I\'m using webview in developing an bilingual browser app for Android.

I tried getting an instance of cus

14条回答
  •  耶瑟儿~
    2020-11-22 12:37

    test it, work for me like a charm :

       private void setResult() {
    
            String mimeType = "text/html;charset=UTF-8";
            String encoding = "utf-8";
            String htmlText = htmlPrivacy;
    
            String text = ""
                    + ""
                    + ""
                    + htmlText
                    + "";
    
            webView.loadDataWithBaseURL(null, text, mimeType, encoding, null);
        }
    

提交回复
热议问题