使相机在Google Maps V2中居中

Dea*_*ely 4 android google-maps google-maps-android-api-2

在我的android应用中,我有以下代码...

CameraUpdate center= CameraUpdateFactory.newLatLng(new LatLng(Lat,Lon));
DebugLog.debugLog("centered camera on " + Lat + " and " + Lon, false);
    CameraUpdate zoom=CameraUpdateFactory.zoomTo(15);
map.moveCamera(center);
    map.animateCamera(zoom);
map.addMarker(new MarkerOptions()
        .position(new LatLng(Lat, Lon))
        .title("Phone Location")
            );
Run Code Online (Sandbox Code Playgroud)

纬度为31.7898纬度为-111.0354

标记正好在正确的位置。但是,摄像头的中心位于v2地图上该位置以北约5英里处。为什么?谢谢加里

Dea*_*ely 5

阅读了一些其他文档后,我发现以下代码可以正常工作...

    CameraPosition cameraPosition = new CameraPosition.Builder()
        .target(new LatLng(Lat, Lon))
        .zoom(15)
        .bearing(0)
        .tilt(45)
        .build();
    map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    map.addMarker(new MarkerOptions()
    .position(new LatLng(Lat, Lon))
    .title("Phone Location")
        );  
Run Code Online (Sandbox Code Playgroud)

我认为我的原始代码也应该起作用。加里