嗨,我想让我的地图放大到我当前的位置.
当前通过向仿真器发送lat和long来定义当前位置.
我该怎么做呢?
我目前的mapactivity.java
public class MapsActivity extends MapActivity {
private MapView mapView;
private MyLocationOverlay myLocOverlay;
MapController mc;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapactivity);
initMap();
initMyLocation();
}
/**
* Initialise the map and adds the zoomcontrols to the LinearLayout.
*/
private void initMap() {
mapView = (MapView) findViewById(R.id.mapView);
View zoomView = mapView.getZoomControls();
LinearLayout myzoom = (LinearLayout) findViewById(R.id.zoom);
myzoom.addView(zoomView);
mapView.displayZoomControls(true);
mapView.getController().setZoom(17);
}
/**
* Initialises the MyLocationOverlay and adds it to the overlays of the map
*/
private void initMyLocation() {
myLocOverlay = new MyLocationOverlay(this,mapView);
myLocOverlay.enableMyLocation();
mapView.getOverlays().add(myLocOverlay);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
谢谢.
最佳答案