我已经安装并使用了以下字体
并使用代码添加字体
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");
这有什么不对吗?
提前致谢