如何在Google Maps API v2上执行此操作?
MapView mv = (MapView) findViewById(R.id.mvGoogle);
mv.setBuiltInZoomControls(true);
MapController mc = mv.getController();
ArrayList all_geo_points = getDirections(17.3849, 78.4866, 28.63491, 77.22461);
GeoPoint moveTo = all_geo_points.get(0);
mc.animateTo(moveTo);
mc.setZoom(12);
mv.getOverlays().add(new MyOverlay(all_geo_points));
答案 0 :(得分:1)
使用FragmentActivity和onCreate()方法:
GoogleMap mMap =((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
ArrayList <LatLng> all_geo_points = new ArrayList<LatLng>();
all_geo_points.add(new LatLng(17.3849, 78.4866));
all_geo_points.add(new LatLng(28.63491, 77.22461));
LatLng moveTo = all_geo_points.get(0);
CameraPosition cameraPosition = new CameraPosition.Builder().target(moveTo).zoom(12).build();
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
检查地图v2 demo。