Reputation: 320
I have this code to draw the arrow tail line between 2 point but how should I draw curved line for arrow tail?
canvas.drawLine(pt1[X], pt1[Y], pt2[X], pt2[Y], paint);//draw line
I want to have something like this, whereby the arrow is dynamic
Upvotes: 1
Views: 1783
Reputation: 234795
Depending on what shape you want for the curved line, you could perhaps use Canvas.drawArc()
, but that is restricted to sections of an oval aligned with the screen axes.
For a more general approach, define your curved line as a Path
and then use Canvas.drawPath()
to render it to the canvas. A Path
can be composed of an arbitrary number of straight line, quadratic curve, and cubic curve segments. (See the docs for how to construct the Path
that you want.) For a solid arrow tail, you should set the paint's style to FILL
when calling drawPath()
.
Upvotes: 1