centering the camera in Google Maps V2

前端 未结 2 1768
栀梦
栀梦 2021-01-13 23:57

In my android app I have the following code...

CameraUpdate center= CameraUpdateFactory.newLatLng(new LatLng(Lat,Lon));
DebugLog.debugLog(\"centered camera o         


        
2条回答
  •  不要未来只要你来
    2021-01-14 00:21

    After reading some additional docs, I found that the following code worked...

        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")
            );  
    

    I think my original code should have also worked. Gary

提交回复
热议问题