I'm including the Roboto family of fonts in my application, and create the fonts in code like so:
Typeface robotoLight = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf");
I have noticed that certain smaller sizes (even the suggested sizes from the Android Developer Typography page) appear distorted or pixelated. Here is a screenshot of a few TextView
s in the app:
"Upcoming Dates" uses a larger size and looks fine. The other ones are sized at 14sp and look awful. The problem is not with margin or padding in the TextView
s -- I've tried altering both. Does anyone know what causes this problem, and how to fix it?
Try the following on each of your TextViews with the custom typeface:
int flags = textView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG
| Paint.ANTI_ALIAS_FLAG;
textView.setPaintFlags(flags);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With