开发者

Android Text Display - Canvas.drawText() output pixelated

开发者 https://www.devze.com 2023-02-11 12:21 出处:网络
My Android app displays text in a few different ways, and there are some annoying differences between them I was hoping folks could help with.

My Android app displays text in a few different ways, and there are some annoying differences between them I was hoping folks could help with.

When I use display methods that might be termed "automatic," the text is displayed very nicely. By automatic methods, I'm referring tools, like Toasts and Button widgets where I just have supply the text, and the OS (or "environment" or whatever) displays it for me. The letters are nicely curved, pleasant to look at, and easily legible.

However, in my code where I handle the text display (using Canvas.drawText() in a Surface Runner View), the text quality is poor. The text is still legible, but it looks pixelated. The letters just don't look their best.

I've开发者_如何学运维 tried experimenting with Paint.setTypeface(), using Typeface.SANS_SERIF for example, but the quality of the display when it's my code is always poor. Doable, but poor.

Has anybody else experienced this? By any chance does anybody have a solution?


You might also try playing around with Paint.setAntiAlias(boolean) or Paint.setSubpixelText(boolean).

0

精彩评论

暂无评论...
验证码 换一张
取 消