如何使用图形类绘制箭头?
我使用Android图形类,基本上我试图在地图上显示路径.所以我需要在画布上打印一个箭头.帮帮我搞清楚!
谢谢!
这是我用来绘制线条的方法之一.我想在每一行的边缘打印一个箭头.
// ArrayList ArrayListPoints = new ArrayList(); // Assign the shortest path here
// ArrayListPoints.add(new Point(262,100));
// ArrayListPoints.add(new Point(262,165));
// ArrayListPoints.add(new Point(346,165));
// ArrayListPoints.add(new Point(420,165));
ArrayList ArrayListPointsFINAL;
ArrayListPointsFINAL = storePath.ArrayListPoints;
if(ArrayListPointsFINAL == null){
System.out.println("ArrayListPointsFINAL is NULL");
}
else{
ArrayList ArrayList_X = new ArrayList();
ArrayList ArrayList_Y = new ArrayList();
//int size = get.ArrayListPoints.size();
for(int i=0; i
ArrayList_X.add(Float.parseFloat(String.valueOf(ArrayListPointsFINAL.get(i).x)));
ArrayList_Y.add(Float.parseFloat(String.valueOf(ArrayListPointsFINAL.get(i).y)));
}
for(int i=1; i
Paint myPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
myPaint.setStrokeWidth(8/*1 /getResources().getDisplayMetrics().density*/);
myPaint.setColor(0xffff0000); //color.RED
// myPaint.setStyle(myPaint);
canvas.drawLine(ArrayList_X.get(i), ArrayList_Y.get(i), ArrayList_X.get(i-1), ArrayList_Y.get(i-1),myPaint);
}