更新时间:2022-12-18 20:09:51
在画布只是创建两边两点要绘制文本,然后创建它们之间的路径。使用这种方法,它会正常工作
On the canvas just create two points on sides where you want to draw text, and then create path between them. use this method it will work fine
Path path = new Path();
Paint paint = new Paint();
path.moveTo(p2.x, p2.y);
path.lineTo(p1.x, p1.y);
canvas.drawTextOnPath(String.valueOf(txt), path, (float) (c.getWidth() / (2.3)), (float) (c.getHeight()/2 + paint.getTextSize()/1.5), paint);