我试过的:
我正在尝试使用以下代码显示箭头线
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 it in onDraw(Canvas canvas)
我得到了以下结果
问题:
我无法绘制所需的预期结果,我无法理解/找到用于显示以下结果的路径配置参数!我未能增加箭头线的长度、宽度大小。
预期结果:
任何帮助将不胜感激!