Setting max zoom level in google maps android api v2

后端 未结 16 2277
无人共我
无人共我 2020-12-02 17:14

I\'m currently working on developing apps by using Google maps android API v2. My code is as follows. Suppose map has several markers and zoom up to show all markers in disp

16条回答
  •  甜味超标
    2020-12-02 17:38

    We can not restrict map zoomin feature directly, but we can try to get same feature like this.

    add map.setOnCameraChangeListener

    final float maxZoom = 10.0f;
    
    @Override
    public void onCameraChange(CameraPosition position) {
    
        if (position.zoom > maxZoom)
            map.animateCamera(CameraUpdateFactory.zoomTo(maxZoom));
    }
    

提交回复
热议问题