使用android系统中的外部字体字体、系统、android

2023-09-12 01:30:38 作者:太在乎的猜忌

我想使用外部字体在我的应用程序。我曾尝试添加使用资产管理公司的新字体,但没有奏效。

i want to use external fonts in my app. i have tried adding new fonts using asset managers but it did not work.

Typeface face;

face = Typeface.createFromAsset(getAssets(), "font.otf");

textview.setTypeface(face);

但它没有显示文本...

but it did not show the text...

plz帮助..

推荐答案

AFAIK,Android不支持OpenType字体。使用TrueType字体代替。

AFAIK, Android does not support OpenType. Use a TrueType font instead.

更新:显然OpenType字体现在支持,至少在某种程度上。它不支持原,所以你会想在任何的Andr​​oid版本的应用程序将支持彻底测试你的字体。

UPDATE: Apparently OpenType is now supported, at least somewhat. It was not supported originally, so you will want to test your font thoroughly on whatever versions of Android your app will support.