Java 未嵌入webview中的字体

Java 未嵌入webview中的字体,java,android,html,css,Java,Android,Html,Css,我正在构建一个android应用程序,其中有一个webview,我正在尝试在其中嵌入一种字体,该字体位于名为mylotus.ttf的资产文件夹中。字体根本没有被嵌入 有什么帮助吗 webView.requestDisallowInterceptTouchEvent(true); try { details_v=decipher(key, det

我正在构建一个android应用程序,其中有一个webview,我正在尝试在其中嵌入一种字体,该字体位于名为mylotus.ttf的资产文件夹中。字体根本没有被嵌入

有什么帮助吗

  webView.requestDisallowInterceptTouchEvent(true);
                         try
                         {
                         details_v=decipher(key, detailss_value);
                         }catch(Exception ex)
                         {}
                        yourHtml = "<html> " +
                                "<head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'/></head>" +
                                "<style type=\"text/css\">" +
                                "@font-face {font-family: MyFont; src: url(\"file:///android_asset/fonts/mylotus.ttf\"); font-style: normal; font-weight: normal;}" +
                                "body{font-family: MyFont; color: #000000; background-color: #ffffff;}" +
                                ".Sec{direction:ltr; font-family: Times New Roman; font-weight:bold; font-size:x-large;}" +
                                ".Prim{color:#000000; direction:ltr;  font-family: MyFont; src: url(\"file:///android_asset/fonts/mylotus.ttf\"); font-weight:bold; font-size:x-large;}" +
                                ".Def_en{direction:ltr; font-family: MyFont; font-weight:Normal; font-size:x-large;}" +
                                ".Def_ar{direction:rtl; font-family: MyFont; font-size:x-large;}" +
                                ".smaller{direction:ltr; font-weight:Normal; font-family: MyFont; font-size:x-large;}" +
                                "</style>" +
                      "<body><table width = '100%' >" +
                                "<tr><td><h1><p align='left' ><font>"+keyword+"</font></p></h1></td></tr>" +
                                "<tr><td><p align='left' ><font>"+detailss_value+"</font></p></td></tr>" +
                                "</table></body></html>";

                        webView.loadDataWithBaseURL(null, yourHtml, "text/html", "UTF-8", null);
webView.requestDisallowWinterCeptTouchEvent(true);
尝试
{
details_v=解密(键、details_值);
}捕获(例外情况除外)
{}
yourHtml=“”+
"" +
"" +
“@font-face{font-family:MyFont;src:url(\”file:///android_asset/fonts/mylotus.ttf\“”;字体样式:普通;字体重量:普通;}”+
“正文{字体系列:MyFont;颜色:#000000;背景色:#ffffff;}”+
“.Sec{方向:ltr;字体系列:Times New Roman;字体大小:粗体;字体大小:x-large;}”+
“.Prim{color:#000000;方向:ltr;字体系列:MyFont;src:url(\”file:///android_asset/fonts/mylotus.ttf\“”;字体大小:粗体;字体大小:x-large;}”+
“.Def_en{方向:ltr;字体系列:MyFont;字体大小:正常;字体大小:x-large;}”+
“.Def_ar{方向:rtl;字体系列:MyFont;字体大小:x-large;}”+
“.small{方向:ltr;字体大小:普通;字体系列:MyFont;字体大小:x-large;}”+
"" +
"" +
“

”+关键字+”

”+ “

”+详细信息值+”

”+ ""; loadDataWithBaseURL(null,yourHtml,“text/html”,“UTF-8”,null);