【发布时间】:2016-12-28 14:55:23
【问题描述】:
我在我的应用程序中使用自定义字体 所以我使用了以下代码
public class BrandonBlackTextView extends TextView {
public BrandonBlackTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public BrandonBlackTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public BrandonBlackTextView(Context context) {
super(context);
init();
}
public void init() {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "font/brandon_blk.ttf");
setTypeface(tf ,1);
}
无论我想在哪里使用,我都会使用textview。有用。
但问题是有时我不知道为什么,但textview 中的文本变为bold。我不知道为什么会这样。而且这是非常不一致的,不会每次都发生。
【问题讨论】:
标签: android custom-font android-typeface