我试图实现使用我自己的自定义字体的自定义textview。使用自定义字体的自定义textview
有没有一种方法来设置字体之前做一个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()来做到这一点吗?