Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两点,比如说(x1,y1)和(x2,y2)。现在我必须使用OnDraw()方法在这些点之间画一条线。
OnDraw()
我试过
Paint mPaint = new Paint() mPaint.setColor(Color.BLACK); path.moveTo(x1, y1); path.lineTo(x2, y2); canvas.drawPath(path, mPaint);
但它不工作
问候,
苏迪尔
像这样试试
canvas.drawLine(p1.x, p1.y, p2.x, p2.y, paint);