`
fantao005x
  • 浏览: 34480 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

android在google地图上画线

 
阅读更多
1.重写ItemizedOverlay的draw方法。
Paint paint = new Paint();
paint.setColor(Color.CYAN);
paint.setDither(true);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setStrokeCap(Paint.Cap.ROUND);

paint.setStrokeWidth(3);
//获取坐标系转换
Projection projection = mapView.getProjection();
int size=points.size();
Path path = new Path();
for(int i=0;i<size;i++){
Point p = new Point();
projection.toPixels(points.get(i), p);
if(i==0)
path.moveTo(p.x, p.y);
else
path.lineTo(p.x, p.y);
}
canvas.drawPath(path, paint);
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics