Android 图形线条看起来呈锯齿状
我正在手动绘制图表(见下文),并且以一定角度绘制的线条看起来参差不齐且不平滑。有什么办法可以让它们看起来更好看吗?
I'm manually drawing the graph (see below), and the lines drawn at an angle look jagged and unsmooth. Is there any way to make them look nicer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发布我的上述评论作为答案:
这只是一个预感,但您看到的效果可能与 Android 渲染非常细的线条的方式有关。当 1 像素宽的线是对角线时,屏幕像素仅包含该线的“部分”,因此它可能会呈现较暗的效果。如果将线条加粗,效果可能会消失,因为线条将“重叠”更多对角线上的屏幕像素。
Posting my above comment as an answer:
This is only a hunch, but the effect you're seeing may have something to do with the way Android renders lines that are very thin. When a 1-pixel-wide line is diagonal, a screen pixel only contains "part" of the line and so it might be rendered dimmer. The effect will probably go away if you make the line thicker, since line will "overlap" more of the screen pixels that are on the diagonal.
您是否在画图中开启了抗锯齿?
Did you turn on anti-aliasing in your Paint?