2011-06-01 94 views
0

我有一个位置,我需要显示。格式是这样的:如何在MapView上显示特定位置?

lat: 59.915494, lng: 30.409456 

此外我需要显示用户的当前位置。以下代码:

MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this, mapView); 
    mapView.getOverlays().add(myLocationOverlay); 
    myLocationOverlay.enableMyLocation(); 

没有在当前位置上居中映射。

回答

2

为了调整地图居中或放大的位置,您需要获取MapController

MapController controller = mMapView.getController(); 
controller.animateTo(geoPoint); 
// Or if you just want it to snap there 
controller.setCenter(geoPoint); 

controller.setZoom(5); 

这一点,你想要显示你将需要添加Overlay。这是documentation为好,还有一个不错的tutorial关于如何做到这一点。

相关问题