WEB开发网
开发学院手机开发Android 开发 Android 通过地名获得经纬度并标识在地图上 阅读

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我把地名写死了

上一页  1 2 3 4 5 

Tags:Android 通过 地名

编辑录入:coldstar [复制链接] [打 印]
赞助商链接