簡體   English   中英

Android字體在TTF中填充透明區域

[英]android typeface fill transparent areas in ttf

我在應用程序中使用ttf作為字體。 我使用的字體是: http : //www.dafont.com/unlearned-bitmap.font?nb_ppp=50

當我在textview上打印文本時,字體筆划及其周圍的區域是透明的,因此我只能看到字體的黑色筆划。 當我設置textview的backgroundcolor時,黑色筆觸內部的區域被着色,但筆觸外部的區域也被着色。 有沒有一種方法可以給字體內部着色,但不能給筆觸周圍的區域着色?

是的,請使用setTextColor()

Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "CustomFont.ttf");
setTypeface(tf);
yourTextView.setTextColor(Color.RED);
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "AnyFont.ttf");
setTypeface(tf);
textview.setTextColor(this.getResources().getColor(R.color.orange));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM