On zoom event for google maps on android

前端 未结 11 2015
清酒与你
清酒与你 2020-11-30 00:04

We\'re building an application which is using the google maps api for android.

I have my MapController and MapView, and I enable the built-in zoom controls using:

11条回答
  •  暖寄归人
    2020-11-30 00:20

    With the Google Maps Android API v2 you can use a GoogleMap.OnCameraChangeListener like this:

    mMap.setOnCameraChangeListener(new OnCameraChangeListener() {
    
        private float currentZoom = -1;
    
        @Override
        public void onCameraChange(CameraPosition pos) {
            if (pos.zoom != currentZoom){
                currentZoom = pos.zoom;
                // do you action here
            }
        }
    });
    

提交回复
热议问题