How to Draw Arrowline in android.graphics.Path with correct configerations -
what have tried:
i'm trying display arrow line next code
path marrowpath=new paint();; marrowpath.rewind(); marrowpath.moveto(0, mheight / 2); marrowpath.lineto(mwidth / 2, 0); marrowpath.lineto(mwidth, mheight / 2); marrowpath.lineto(mwidth * 3 / 4, mheight / 2); marrowpath.lineto(mwidth * 3 / 4, mheight); marrowpath.lineto(mwidth / 4, mheight); marrowpath.lineto(mwidth / 4, mheight / 2); marrowpath.lineto(0, mheight / 2); shape pathshap = new pathshape(marrowp,maxwidth,maxheight); shapedrawable shaped = new shapedrawable(pathshap); shaped.draw(canvas); //display in ondraw(canvas canvas)
i have got next result
problem:
i'm not able draw required expected result, i'm failed understand/find path configuration parameters displaying next result! i'm failed increment length, width size of arrow line.
expected result:
any help grateful !
you can utilize canvas.rotate() method rotate arrow
or
path marrowpath=new paint();; 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); shape pathshap = new pathshape(marrowp,maxwidth,maxheight); shapedrawable shaped = new shapedrawable(pathshap); shaped.draw(canvas);
android android-canvas android-view android-shape
No comments:
Post a Comment