我正在尝试实现一个使用我自己的自定义字体的自定义文本视图。
有没有办法在做 Super.onDraw() 之前设置字体?
以便将常用字体替换为我要使用的自定义字体。
就像是:
protected void onDraw(Canvas canvas)
{
Typeface font1 = Typeface.createFromAsset(context.getAssets(), "fonts/myfonts.ttf");
this.setTypeface(font1);
this.setTextSize(18);
super.onDraw(canvas);
}
我知道上面的代码行不通。
还是我别无选择,只能使用 drawText() 这样做?