Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to layout zoom Control with setBuiltInZoomControls(true)?

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 getZoomControl but it is deprecated.

Could anyone tell me how to do this with setBuildtInZoomControls?

like image 273
Mak Sing Avatar asked Nov 20 '09 03:11

Mak Sing


1 Answers

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

like image 61
duskstriker Avatar answered Sep 28 '22 08:09

duskstriker