您可以使用Overlay创建Multiple子类。现在当前的位置是固定的,我认为你不能做任何像onclick或者其他只能显示和维护当前位置的类。
所以现在选择位置。好吧,我认为你想改变该针位置的位置。正如你可以在onTap中实现的那样,你可以使用onTouch()方法并实现地图的down,move,up事件,假设我点击地图,那么你现在就可以将这个位置值转换成屏幕x,y值添加通过引脚放置在该地方。
这里,我已经实现像这样的地方在地图上的引脚时,在地图上
public boolean onTouchEvent(MotionEvent event, final MapView mapView) {
final int action=event.getAction();
final int x=(int)event.getX();
final int y=(int)event.getY();
result = false;
if (action==MotionEvent.ACTION_DOWN) {
downPressed = true;
drag = false;
result = false;
}else if (action==MotionEvent.ACTION_MOVE) {
downPressed = false;
drag=true;
}else if (action==MotionEvent.ACTION_UP) {
if(downPressed){
if(task.equals(SINGLE_LOCATION) | isDirectionPoint | mapView.isStreetView()){
tempPoint = mapView.getProjection().fromPixels(x, y);
mapView.invalidate();
}
}
drag = false;
downPressed = false;
}
return(result | super.onTouchEvent(event, mapView));
}
这里用户水龙头是我的抽签方法,该方法是在绘制调用()方法
private void drawFreeMarker(Canvas canvas, MapView mapView, boolean shadow) {
Point screenPts = new Point();
mapView.getProjection().toPixels(tempPoint, screenPts);
//---add the marker---
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.bluepin_38);
canvas.drawBitmap(bmp, screenPts.x-((xCurLocOffset/2)-1), screenPts.y-(yCurLocOffset-1), null);
}