Skip to content Skip to sidebar Skip to footer

How To Draw Arrowline In Android.graphics.path With Correct Configerations

What I have Tried: I'm trying to display the arrow line with following code Path mArrowPath=new Paint();; mArrowPath.rewind(); mArrowPath.moveTo(0, mHeight / 2); mArrowPath.lineTo(

Solution 1:

you can use canvas.rotate() method to rotate arrow

OR

Path mArrowPath=newPaint();;
mArrowPath.rewind();
mArrowPath.moveTo(mWidth , mHeight / 2);
mArrowPath.lineTo(mWidth / 2, mHeight );
mArrowPath.lineTo(mWidth / 2, mHeight* 3 / 4);
mArrowPath.lineTo(0, mHeight* 3 / 4);
mArrowPath.lineTo(0, mHeight/ 4);
mArrowPath.lineTo(mWidth / 2, mHeight/ 4);
mArrowPath.lineTo(mWidth / 2,0);
mArrowPath.lineTo(mWidth , mHeight / 2);
Shapepathshap=newPathShape(mArrowP,maxWidth,maxHeight);

ShapeDrawableshapeD=newShapeDrawable(pathshap);

shapeD.draw(canvas);

Post a Comment for "How To Draw Arrowline In Android.graphics.path With Correct Configerations"