1
将自定义字体设置为HTML页面并使用loadDataWithBaseURL加载HTML数据时,粗体标记被忽略。我的代码是如下:Webview加载标签问题loadDataWithBaseURL
webView.loadDataWithBaseURL("", "<html><style type=\"text/css\"> @font-face { font-family:\"customFont\"; src:url('file:///android_asset/fonts/customfont.ttf');line-height:45px;font-size:34px;} body { font-family:'customFont'; }</style><body><b>The legend is back!!</b></body></html>", "text/html", "utf-8", "");
我的如下所示的输出:
当如下所示相同的内容使用loadData加载:
webView.loadData("", "<html><style type=\"text/css\"> @font-face { font-family:\"customFont\"; src:url('file:///android_asset/fonts/customfont.ttf');line-height:45px;font-size:34px;} body { font-family:'customFont'; }</style><body><b>The legend is back!!</b></body></html>", "text/html", "utf-8", "");
我的输出是如下所示:
不确定可能出现的问题。是否有任何具体原因相同。
你有没有解决这个问题。即使我有同样的问题。 – amsiddh 2013-06-27 07:14:22
尝试使用loadUrl方法,仍然是同样的问题。 – amsiddh 2013-06-27 11:33:22