Reputation: 934
when draw a line in canvas using path i getting little glitch as in picture below...i'm new to android development..i know i'm making some silly mistake i don't know what it is...if anyone hav an idea help me..thanks
my path code is
path.moveTo((this.pos/2),0);
path.lineTo((this.pos/2),25);
path.lineTo(this.pos,25);
path.close();
canvas.drawPath(path, ppaint);
Upvotes: 2
Views: 241
Reputation: 2238
You could try
ctx.beginPath();
ctx.moveTo((this.pos/2),0);
ctx.lineTo((this.pos/2),25);
ctx.lineTo(this.pos,25);
ctx.closePath();
ctx.strokeStyle = "Red";//border color here
ctx.stroke();
ctx.fillStyle = "blue";//fill color here
ctx.fill();
Upvotes: 0
Reputation: 12823
You can just use canvas.drawLine(this.pos/2, 25, this.pos, 25, ppaint)
. drawPath() is working as expected in your code ;)
Upvotes: 1