你介意帮我解决这个问题吗?
我想在位图上画一个圆,然后在 mapView 上画位图。但位图仍未创建。这是我的代码:
public class CustomOverlay extends Overlay {
public HeatPoint pt;
Context mContext;
Bitmap bmp;
public CustomOverlay(HeatPoint pt,Context context){
this.pt=pt;
this.mContext = context;
bmp = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888);
Paint gp = new Paint();
gp.setColor(0xFF0000);
gp.setStyle(Style.FILL);
Canvas myCanvas = new Canvas(bmp);
myCanvas.drawRect(10,10,40,40,gp);
}
@Override
public boolean draw(Canvas canvas, MapView mapView,
boolean shadow, long when)
{
super.draw(canvas, mapView, shadow);
Point screenPts = new Point();
mapView.getProjection().toPixels(pt.getGeo(), screenPts);
canvas.drawBitmap(bmp, screenPts.x-16, screenPts.y-2, null);
return true;
}
}
在这段代码中,我想在屏幕上画一个圆圈,但是当我运行它时,什么也没发生。谢谢你的帮助。