How to layout zoom Control with setBuiltInZoomControls(true)?

前端 未结 6 1176
迷失自我
迷失自我 2020-12-09 23:16

would like to add a zoom control to the map. I also want to layout the position of the zoom Control instead of the default middle bottom position. I can do this by getZoomCo

6条回答
  •  庸人自扰
    2020-12-09 23:57

    This is how I got mine working finally (by embedding a ZoomControl in XML layout).

    mapView = (MapView) this.findViewById(R.id.mapView);
    
    ZoomControls zoomControls = (ZoomControls) findViewById(R.id.zoomcontrols);
    zoomControls.setOnZoomInClickListener(new OnClickListener() {
            public void onClick(View v) {
                mapView.getController().zoomIn();
            }
    });
    zoomControls.setOnZoomOutClickListener(new OnClickListener() {
            public void onClick(View v) {
                mapView.getController().zoomOut();
            }
    });
    

    See: Always show zoom controls on a MapView

提交回复
热议问题