Display ZoomControls, Compass and MyLocation buttons on GoogleMap.

To enable/disable ZoomControls, Compass and MyLocation buttons on GoogleMap, call the following methods of the UiSettings for GoogleMap.
  • setZoomControlsEnabled (boolean enabled):

    Enables or disables the zoom controls. If enabled, the zoom controls are a pair of buttons (one for zooming in, one for zooming out) that appear on the screen. When pressed, they cause the camera to zoom in (or out) by one zoom level. If disabled, the zoom controls are not shown.

    By default, the zoom controls are enabled.

  • setCompassEnabled (boolean enabled):

    Enables or disables the compass. The compass is an icon on the map that indicates the direction of north on the map. If enabled, it is only shown when the camera is tilted or rotated away from its default orientation (tilt of 0 and a bearing of 0). When a user clicks the compass, the camera orients itself to its default orientation and fades away shortly after. If disabled, the compass will never be displayed.

    By default, the compass is enabled (and hence shown when the camera is not in the default orientation).

  • setMyLocationButtonEnabled (boolean enabled):

    Enables or disables the my-location button. The my-location button causes the camera to move such that the user's location is in the center of the map. If the button is enabled, it is only shown when the my-location layer is enabled.

    By default, the my-location button is enabled (and hence shown when the my-location layer is enabled).

Example:

  myMap.getUiSettings().setZoomControlsEnabled(true);
myMap.getUiSettings().setCompassEnabled(true);
myMap.getUiSettings().setMyLocationButtonEnabled(true);

Display ZoomControls, Compass and MyLocation buttons on GoogleMap.


The series:
A simple example using Google Maps Android API v2, step by step.

thumbnail
Title: Display ZoomControls, Compass and MyLocation buttons on GoogleMap.
Rating: 100% based on 99998 ratings. 10 user reviews.
Post by

Related articles :

0 comments:

Post a Comment

My Blog List

 
Copyright © 2015. About - Web Version - Mobile Version Sitemap - Contact - Privacy