画一条线,在Android的弧形边缘 [英] Draw a line with curved edges in Android

查看:170
本文介绍了画一条线,在Android的弧形边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 canvas.drawLine 来拉拢Android的一些线路,但线条太尖锐,但我需要一个弯曲的边缘

I am using canvas.drawLine to draw some line in android but the lines are too sharp but i need a curved edges

在这里,1是我和2个是我想达到的,意味着弯曲的边缘,而不是直的边缘线

Here the 1 is what i have and 2 is what i want to achieve, means a line with curved edges rather than straight edges

我怎样才能做到这一点?

How can I achieve that ??

编辑2:

我试图使用Canvas对象划清界限。但线条有锋利的边缘,我需要一个四舍五入的边缘
我现在用的油漆对象

I am trying to use the Canvas object to to draw a line. but the lines have a sharp edge, I need a rounded off edge I am using the Paint object

mPaint = new Paint();
mPaint.setColor(Color.BLACK)

任何帮助是AP preciated。谢谢

Any help is appreciated. Thank you

推荐答案

使用 Paint.setStrokeCap​​()方法。您需要 Paint.Cap.ROUND 。默认的是 Paint.Cap.BUTT 。有被称为路径加入一个类似路径属性。它确定如何绘制它的构成线段连接路径的部分。要设置使用 Path.setPathJoin()。您可能需要它的未来。
祝你好运。

Use the Paint.setStrokeCap() method. You need Paint.Cap.ROUND. The default one is Paint.Cap.BUTT. There is a similar Path property that is called path join. It determines how to draw the parts of the path where it's constituent segments join. To set it use Path.setPathJoin(). You might need it in the future. Good luck.

这篇关于画一条线,在Android的弧形边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆