Custom font for webview

后端 未结 6 575
伪装坚强ぢ
伪装坚强ぢ 2020-12-11 05:19

I am trying to establish a new custom font (otf file) for my web view.

I put anbaaarabic_bold.otf in assets file.

There is how i do:

String h         


        
6条回答
  •  执念已碎
    2020-12-11 05:44

    To get URI for a file placed in /assets folder, you will need to use:

    file:///android_asset/file_name
    

    Try the following code:

    String head = "";
    String htmlData= ""+head+""+body+"" ;
    
    mBodyArticle.loadDataWithBaseURL("http://nada", htmlData,
                    "text/html", "utf-8", "");
    

    Make sure that you use the exact file name (case-sensitive).

提交回复
热议问题