Android 使用自定义字体
/**
* 设置自定义字体
* @param mContext
* @param mTv 需要设置自定义字体的textView;
*/
public static void setTextFont(Context mContext,TextView mTv){
Typeface typeface = Typeface.createFromAsset(mContext.getAssets(), "fonts/AdobeGaramondLTBold.ttf");
mTv.setTypeface(typeface);
}
需要注意的是
字体文件放在assets/fonts/xxx.ttf
文件字体格式需要正确 否则可能加载失败 如果字体文件过大 可能造成界面绘制卡顿