2013-04-30 97 views
1

當我在TextView中繪製文本或在LinearLayout中填充背景顏色時,我發現了一些在Windows編程中找不到的奇怪現象。Android:如何關閉文本視圖和佈局的抗鋸齒

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開發者的常見問題, 所以我會非常感謝您的任何建議。

謝謝。

回答

1

我想這一點,和它的工作對我來說:

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

這樣有效地禁止antialising,所以國際海事組織它不是做,但如果它是你在找什麼,你去那裏。