how to show foreign font in web view

淺唱寂寞╮ 提交于 2019-12-09 00:14:39

问题


MY app has to show hindi text from the HtmlString in a web view

HtmlString ="<html><body style='background-color:#000000; color:ffffff; font-family:georgia,times new roman,times,seri,krutidev010; margin-top:0px; margin-bottom:0px; margin-right:0px; margin-left:0px; padding:0px;'><div style='padding:0px;'></div><div style='padding:5px;'><b>"+SharedVariables.ArrayOfNewsItems.get(SelectedRow).getTitle()+"</b><p align='justify'>"+SharedVariables.ArrayOfNewsItems.get(SelectedRow).getContent()+"</p></div><p></p></body></html>";
MyWebView.loadData(HtmlString, "contentType=text/html", "charset=UTF-8");

How can I do that.


回答1:


 head="<head><style>@font-face {font-family: 'APARAJ';src: url('file:///android_asset/fonts/APARAJ.TTF');}body {font-family: 'APARAJ';}</style></head>";
                HtmlString = "<html>"+head+"<body>"+content+"</body></html>";  
MyWebView.loadData(HtmlString, "contentType=text/html", "charset=UTF-8");


来源:https://stackoverflow.com/questions/5868198/how-to-show-foreign-font-in-web-view

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!