我正在开发新的Android应用程序...我尝试在2.2模拟器中加载webview中的html内容但不支持tamil字体
这里是我的代码......
WebView learn2crack = (WebView)findViewById(R.id.webview);
learn2crack.getSettings().setDefaultTextEncodingName("utf-8");
learn2crack.getSettings().setJavaScriptEnabled(true);
learn2crack.loadUrl("http://www.dinamalar.com/");
提前致谢
答案 0 :(得分:1)
答案 1 :(得分:0)
Typeface tf = Typeface.createFromAsset(getAssets(), "Bamini.ttf");
String tamil_string="செய்திகள்";
//creating intance of TamilFotnUtil Class
TamilFontUtil tfUtil = new TamilFontUtil();
//Convert Tamil font encording using the utility.
String tamilStringEncoded = tfUtil.convertTamilString(tamil_string);
在样式
中添加以下行@font-face {font-family: MyCustomFont; src: url("Bamini.ttf")}body {font-family: MyCustomFont, Verdana, Arial, sans-serif; font-size: medium; color: black}"
例如
<html> <head>
<title>example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">@font-face {font-family: MyCustomFont; src:
url(file:///android_asset/Bamini.ttf)}body {font-family: MyCustomFont, Verdana, Arial,
sans-serif; font-size: medium; color: black}</head><body>
<h1>tamilStringEncoded </h1></body></html>
最后将数据加载到webview ....