我試圖實現使用我自己的自定義字體的自定義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()來做到這一點嗎?