Guy
Guy

Reputation: 6522

Create custom zoom buttons for Google Maps

I disable zoom controls on Google Maps:

map:uiZoomControls="false"

and now I want to create my own zoom/unzoom buttons. Is this possible? And if it is, how is it done?

I hate to ask a question without showing any research effort but I really can't find a single thing about custom buttons. I read the whole Google Maps API documentation and there is no information on this whatsoever.

Could anyone point me in the right direction? Is this even possible since there's no info on it in official docs? I don't want to change the position of default buttons, I want to disable them and actually make my own buttons.

Upvotes: 1

Views: 3457

Answers (2)

Shailendra Madda
Shailendra Madda

Reputation: 21531

You should use mapView.getController().zoomIn() and mapView.getController().zoomOut(). It gives you animated zoom like google maps default zooming controls and also you don't need to take care of zoom level by yourself.

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1006614

Is this possible?

Sure.

And if it is, how is it done?

Step #1: Add the Button, ImageButton, or whatever to your UI.

Step #2: When the button is clicked, change the zoom level using a CameraUpdate.

I hate to ask a question without showing any research effort but I really can't find a single thing about custom buttons.

There is a fair bit of documentation on the use of the Button widget, and its subclasses.

Upvotes: 2

Related Questions