0

我想在 mapview 上显示用户位置,我可以。但是当用户此时移动到另一个位置时,我无法更新地理点 - 当查看地图时 - 我该怎么做?

     List<Overlay> mapOverlays = mapView.getOverlays();
     Drawable drawable = this.getResources().getDrawable(resID);
     HelloItemizedOverlay itemizedoverlay = new        HelloItemizedOverlay(drawable,this);
     GeoPoint point = new GeoPoint((int)latd,(int)lond);
     OverlayItem overlayitem = new OverlayItem(point, name, name);
     itemizedoverlay.addOverlay(overlayitem);
     mapOverlays.add(itemizedoverlay);
4

1 回答 1

0

在你onLocationChanged()Location Listener你需要再次编写相同的代码,

     List<Overlay> mapOverlays = mapView.getOverlays(); 
     mapOverlays.clear() // add this to remove previous
     Drawable drawable = this.getResources().getDrawable(resID); 
     HelloItemizedOverlay itemizedoverlay = new        HelloItemizedOverlay(drawable,this); 
     GeoPoint point = new GeoPoint((int)latd,(int)lond); 
     OverlayItem overlayitem = new OverlayItem(point, name, name); 
     itemizedoverlay.addOverlay(overlayitem); 
     mapOverlays.add(itemizedoverlay); 
于 2012-04-06T12:23:37.357 回答