Google Maps v2 Set Zoom Level

前端 未结 5 812
遇见更好的自我
遇见更好的自我 2021-02-12 16:46

When I launch Google maps in Android, it shows the whole world. What do i need to change so as to set the zoom to the marker? Here are the codes. Thanks

                 


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-12 17:16

    try this---->

      map.addMarker(new MarkerOptions().position(latlng)).setVisible(true);
    
      // Move the camera instantly to location with a zoom of 15.
      map.moveCamera(CameraUpdateFactory.newLatLngZoom(latlng, 15));
    
      // Zoom in, animating the camera.
      map.animateCamera(CameraUpdateFactory.zoomTo(14), 2000, null);
    

提交回复
热议问题