0

如何在 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));
4

1 回答 1

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演示

于 2013-07-11T15:39:11.483 回答