我需要在谷歌地图上以最大缩放级别显示我的当前位置和目标位置。这是我的代码,以最大缩放显示两个位置。但是它缩放到两个位置的中心和我的位置都看不见了。我希望我的两个位置都应该在视图范围内,并尽可能将缩放设置为最大。请帮我。提前致谢。
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapMarker = getResources().getDrawable(R.drawable.map_marker);
overlayList = mapView.getOverlays();
myMap = new MyLocationOverlay(this, mapView);
myMap.enableMyLocation();
mapController = mapView.getController();
GeoPoint geoPoint = new GeoPoint((int) (targetLatitude * 1E6), (int) (targetLongitude * 1E6));
mapController.animateTo(new GeoPoint(((int) (targetLatitude * 1E6) + (int) (currentLatitude * 1E6))/2, ((int) (targetLongitude * 1E6) + (int) (curLongitude * 1E6))/2 ));
mapController.zoomToSpan((int)(targetLatitude - currentLatitude), (int)(targetLongitude - curLongitude));
mapController.setZoom(12);
OverlayItem overlayItem = new OverlayItem(geoPoint,"xxx", "yyyy");
CustomPinpoint customPinpoint = new CustomPinpoint(mapMarker, this);
customPinpoint.insertPinpoint(overlayItem);
overlayList.clear();
overlayList.add(myMap);
overlayList.add(customPinpoint);