添加第三方字体文件
将下载好的 字体文件放到在assert目录下
自定义TextView
这里作为记录 直接贴代码
/**
* @author michelle
* @date 2019/4/22 10:35
* @describe 使用PingFang-SC-Bold字体的TextView
*/
public class BoldTextView extends android.support.v7.widget.AppCompatTextView {
public BoldTextView(Context context) {
super(context);
init(context);
}
public BoldTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public BoldTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context);
}
/**
* 设置字体
*
* @param context
*/
private void init(Context context) {
setTypeface(FontUtils.setBoldFont(context));
}
}
/**
* @author miche