package com.example.fonttest;

import android.support.v7.app.ActionBarActivity;
import android.webkit.WebView;
import android.os.Bundle; public class MainActivity extends ActionBarActivity { WebView wv; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
wv = (WebView) findViewById(R.id.wvShow);
String pish = "<html><head><style type=\"text/css\">@font-face {font-family: MyFont;src: url(\"file:///android_asset/font/segoeui.ttf\")}body {font-family: MyFont;font-size: medium;text-align: justify;}</style></head><body>";
String pas = "</body></html>";
String myHtmlString = pish + "/dɒɡ/" + pas;
wv.loadDataWithBaseURL(null,myHtmlString, "text/html", "UTF-8", null);
} }
android系统自带的字体都不支持显示音标,只能自己把支持音标显示的字体加入项目中
在 C:\Windows\Fonts\Segoe UI目录下选择一个常规字体(segoeui.ttf)复制出来放在assets/font/目录下

05-08 08:17