简体   繁体   中英

android typeface fill transparent areas in ttf

I'm using a ttf for my fonts in my app. The font i'm using is like: http://www.dafont.com/unlearned-bitmap.font?nb_ppp=50

When i print text on a textview, the area in and around the strokes of the font is transparent, so i see only the black strokes of the font. When i set the backgroundcolor of the textview, the area inside the black strokes is colored, but also the area outside the strokes. Is there a way to color the inside of the font, but not the area around the strokes?

Yes, use 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));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM