我试图在 WebView
中显示注音符号,但到目前为止我只得到正方形。
例如,对于单词“撇号”,应该显示为:
əˈpåstrəfi
但我在显示屏上看到的是:
□□påstr□fi
如果有帮助的话,我正在从 SQLite 数据库中获取字符串。我检索的字符串中有一些 HTML 标记,所以我使用这个:
webView.loadDataWithBaseURL("file:///android_asset/",
article, "text/html", Encoding.UTF_8.toString(), null);
我的 CSS 文件位于 /assets
中。 article
变量包含一些包含在 HTML 标记中的文本。
最佳答案
我已经解决了在 TextView 中显示注音符号的问题。问题是默认的 android 字体没有实现 IPA 符号。我可以建议像这样使用 ccs
@font-face {
/* Regular */
font-family: "ConstructiumRegular";
src: url("http://openfontlibrary.org/content/RebeccaRGB/412/Constructium.ttf") format("truetype");
font-weight: 400;
font-style: normal;
font-variant: normal;
font-stretch: normal;
}
在我的案例中提到的 Constructium.ttf 适合。
关于android - 如何在 Android 上显示注音 (IPA) 符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4827295/