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
?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With