我想在mapview上显示用户位置,我可以。但是当用户此时移动到另一个位置时我无法更新geopoint - 当看地图时 - 我该怎么做?
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);
答案 0 :(得分: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);