2011-06-01 95 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關於如何做到這一點。

相關問題