Android 通过地名获得经纬度并标识在地图上
2010-10-21 01:38:14 来源:WEB开发网核心提示:{super();this.geoPoint = geoPoint;this.context = context;this.drawable = drawable;}@Overridepublic void draw(Canvas canvas, MapView mapView, boolean shadow) {Pr
{
super();
this.geoPoint = geoPoint;
this.context = context;
this.drawable = drawable;
}
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
Projection projection = mapView.getProjection();
Point point = new Point();
projection.toPixels(geoPoint, point);
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),
drawable);
canvas.drawBitmap(bitmap, point.x-bitmap.getWidth()/2 , point.y-bitmap.getHeight(), null);
super.draw(canvas, mapView, shadow);
}
}
}
效果图如下:
程序就这么简单,作为demo我把地名写死了
[]
赞助商链接