Android 如何在地图视图上显示特定位置?
我有一个位置,我需要显示。格式如下:Android 如何在地图视图上显示特定位置?,android,android-mapview,Android,Android Mapview,我有一个位置,我需要显示。格式如下: lat: 59.915494, lng: 30.409456 我还需要显示用户的当前位置。以下代码: MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this, mapView); mapView.getOverlays().add(myLocationOverlay); myLocationOverlay.enableMyLocation(); 不将地图
lat: 59.915494, lng: 30.409456
我还需要显示用户的当前位置。以下代码:
MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this, mapView);
mapView.getOverlays().add(myLocationOverlay);
myLocationOverlay.enableMyLocation();
不将地图居中于当前位置。要调整地图居中或放大的位置,需要获取
地图控制器
MapController controller = mMapView.getController();
controller.animateTo(geoPoint);
// Or if you just want it to snap there
controller.setCenter(geoPoint);
controller.setZoom(5);
您要显示的点需要添加一个覆盖层
。这是一个很好的例子和一个很好的方法