我已经安装并使用了以下字体
- Antartida 圆形黑色
- Antartida 圆形黑色斜体
- Antartida 圆角粗体
- Antartida 圆角粗斜体
- Antartida圆灯
- Antartida 圆形浅斜体
- Antartida圆形培养基
- Antartida 圆形中斜体
并使用代码添加字体
Typeface tp = TypeFaces.get(context, "font/AntartidaRounded-Black.ttf");
textView.setTypeface(tp);
设置字体
public class TypeFaces {
private static final String TAG = "Typefaces";
private static final Hashtable<String, Typeface> cache = new Hashtable<String, Typeface>();
public static Typeface get(Context c, String assetPath) {
synchronized (cache) {
if (!cache.containsKey(assetPath)) {
try {
Typeface t = Typeface.createFromAsset(c.getAssets(), assetPath);
cache.put(assetPath, t);
} catch (Exception e) {
Log.e(TAG, "Could not get typeface '" + assetPath + "' because " + e.getMessage());
return null;
}
}
return cache.get(assetPath);
}
}
}
使用
Typeface tf = TypeFaces.get(c, "font/AntartidaRounded-Bold.ttf");
这有什么不对吗?
提前致谢