Custom font in android webView -


i used font on webview

            string data = "<!doctype html>";             data +="<head>\n" +                     "<style type=\"text/css\">\n" +                     "@font-face {\n" +                     "    font-family: myfont;\n" +                     "    src: url(\'file:///android_asset/fonts/myfont.otf\')\n" +                     "}\n" +                     "body {\n" +                     "    font-family: myfont;\n" +                     "    font-size: medium;\n" +                     "    text-align: justify;\n" +                     "}\n" +                     "</style>\n" +                     "</head>";             data += "<body dir=\"rtl\" style=\"text-align:justify\">";             data += "my text";             data +="</body></html>";             // args: data, mimetype, encoding             web1.loaddata(`data, "text/html", null); 

but not working font. alot in advance

you need specify file:///android_asset base url data: uri:

web1.loaddatawithbaseurl("file:///android_asset/", data, "text/html", "utf-8", null); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -