谷歌地图:放大和缩小不工作的android应用程序

谷歌地图:放大和缩小不工作的android应用程序,android,google-maps,zooming,Android,Google Maps,Zooming,我正在做一个android游戏,在那里我必须画一个长方形的院子[足球场]。我用多边形在谷歌地图上画矩形。代码如下: PolygonOptions polygonOptions = new PolygonOptions() .add(new LatLng(bounds.northeast.latitude, bounds.northeast.longitude)) .add(new LatLng(bounds.southwest.latit

我正在做一个android游戏,在那里我必须画一个长方形的院子[足球场]。我用多边形在谷歌地图上画矩形。代码如下:

    PolygonOptions polygonOptions =  new PolygonOptions()
            .add(new LatLng(bounds.northeast.latitude, bounds.northeast.longitude))
            .add(new LatLng(bounds.southwest.latitude, bounds.northeast.longitude))
            .add(new LatLng(bounds.southwest.latitude, bounds.southwest.longitude))
            .add(new LatLng(bounds.northeast.latitude, bounds.southwest.longitude))
            .strokeColor(color);
    mMap.addPolygon(polygonOptions);
我尝试了谷歌地图放大的各种代码:

代码1:

 map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
代码2:

 CameraPosition cameraPosition = new CameraPosition.Builder()
            .target(new LatLng(Latitude, Longitude))      // Sets the center of the map to Mountain View
            .zoom(30)                   // Sets the zoom
            .bearing(90)                // Sets the orientation of the camera to east
            .tilt(30)                   // Sets the tilt of the camera to 30 degrees
            .build();                   // Creates a CameraPosition from the builder
    map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
代码3:

map.animateCamera(CameraUpdateFactory.zoomIn());
这些代码都不适合我。欢迎任何帮助

您可以通过以下方式向UI添加缩放控制(按钮):

map.getUiSettings().setZoomControlsEnabled(true);

20
的缩放级别已经是
Buildings
级别。在放大之前,请尝试获取浮动贴图。getMaxZoomLevel()。@Foxana我尝试了最大缩放级别,但它不起作用