對於我正在使用的應用程序,我正在使用給定座標在畫布上畫一條線。問題是我需要在它旁邊畫一條虛線。由於座標來自API,我只能使用這些座標來表示虛線。有什麼辦法可以做到這一點?我真的無法弄清楚。在畫布上用另一條虛線畫線
我畫我的當前行的方式:
Path line = new Path();
boolean first = true;
for (CircleArea circle : mCircles) {
canv.drawCircle(circle.getDrawX(), circle.getDrawY(), mCircleRadius, mCirclePaint);
if(!first) {
line.lineTo(circle.getDrawX(), circle.getDrawY());
} else {
line.moveTo(circle.getDrawX(), circle.getDrawY());
}
first = false;
}
canv.drawPath(line, mLinePaint);
,樣品座標:
- 50,50
- 75,75
- 100,75
- 150,10
- 170,10
- 170,75
- 160,75
您能否提供您從服務器獲得的座標示例列表? –
添加樣本座標,使用這些座標,畫布的最大x和y值爲200,100。 –