Android:如何关闭TextView和Layout的抗锯齿功能

Android:如何关闭TextView和Layout的抗锯齿功能,android,colors,paint,Android,Colors,Paint,当我在TextView中绘制文本或在LinearLayout中填充背景色时, 我发现了一些在Windows编程中找不到的奇怪的东西 The background color in the Layout and text color in TextView, are not a single color, but a mixed color when I capture the phone screen and see and check the pixel value on the PC. 如

当我在TextView中绘制文本或在LinearLayout中填充背景色时, 我发现了一些在Windows编程中找不到的奇怪的东西

The background color in the Layout and text color in TextView,
are not a single color, but a mixed color
when I capture the phone screen and see and check the pixel value on the PC.
如果我将文本颜色或设置为0xFF1010FF(蓝色), 大多数像素是0xFF1010FF, 其中一些是0xFF1010FD或0xFF1010FE,颜色值稍有不同, 我想这是为了消除混叠

布局背景色也是如此。(每个像素有1或2个值差)

这些效果使得android中的颜色看起来比PC更平滑, 但我不想这样填充颜色,只想用精确的颜色值

Can I make the color with an exact single value?
我尝试了
TextPaint.getPaint().setAntiAlias(false)但它不起作用

此外,我可能无法使用TextPaint作为布局背景

这个问题对于大多数android开发者来说都是一个共同的问题, 因此,我将非常感谢您的任何建议


谢谢。

我试过这个,它对我有效:

TextView textView1 = (TextView) findViewById(R.id.textView1);
textView1.getPaint().setAntiAlias(false);

这实际上禁用了反序列化,所以在我看来这是不可能的,但如果这是您想要的,那就去吧。

我尝试过这个,它对我有效:

TextView textView1 = (TextView) findViewById(R.id.textView1);
textView1.getPaint().setAntiAlias(false);
这实际上禁用了反序列化,所以在我看来这是不可能的,但如果这是你想要的,那就去吧