UiSettings

public final class UiSettings extends Object

Settings for the user interface of a GoogleMap. To obtain this interface, call GoogleMap.getUiSettings().

Public Method Summary

boolean
isCompassEnabled()
Gets whether the compass is enabled/disabled.
boolean
isIndoorLevelPickerEnabled()
Gets whether the indoor level picker is enabled/disabled.
boolean
isMapToolbarEnabled()
Gets whether the Map Toolbar is enabled/disabled.
boolean
isMyLocationButtonEnabled()
Gets whether the my-location button is enabled/disabled.
boolean
isRotateGesturesEnabled()
Gets whether rotate gestures are enabled/disabled.
boolean
isScrollGesturesEnabled()
Gets whether scroll gestures are enabled/disabled.
boolean
isScrollGesturesEnabledDuringRotateOrZoom()
Gets whether scroll gestures are enabled/disabled during rotation and zoom gestures.
boolean
isTiltGesturesEnabled()
Gets whether tilt gestures are enabled/disabled.
boolean
isZoomControlsEnabled()
Gets whether the zoom controls are enabled/disabled.
boolean
isZoomGesturesEnabled()
Gets whether zoom gestures are enabled/disabled.
void
setAllGesturesEnabled(boolean enabled)
Sets the preference for whether all gestures should be enabled or disabled.
void
setCompassEnabled(boolean enabled)
Enables or disables the compass.
void
setIndoorLevelPickerEnabled(boolean enabled)
Sets whether the indoor level picker is enabled when indoor mode is enabled.
void
setMapToolbarEnabled(boolean enabled)
Sets the preference for whether the Map Toolbar should be enabled or disabled.
void
setMyLocationButtonEnabled(boolean enabled)
Enables or disables the my-location button.
void
setRotateGesturesEnabled(boolean enabled)
Sets the preference for whether rotate gestures should be enabled or disabled.
void
setScrollGesturesEnabled(boolean enabled)
Sets the preference for whether scroll gestures should be enabled or disabled.
void
setScrollGesturesEnabledDuringRotateOrZoom(boolean enabled)
Sets the preference for whether scroll gestures can take place at the same time as a zoom or rotate gesture.
void
setTiltGesturesEnabled(boolean enabled)
Sets the preference for whether tilt gestures should be enabled or disabled.
void
setZoomControlsEnabled(boolean enabled)
Enables or disables the zoom controls.
void
setZoomGesturesEnabled(boolean enabled)
Sets the preference for whether zoom gestures should be enabled or disabled.

Inherited Method Summary

Public Methods

public boolean isCompassEnabled ()

Gets whether the compass is enabled/disabled.

Returns
  • true if the compass is enabled; false if the compass is disabled.

public boolean isIndoorLevelPickerEnabled ()

Gets whether the indoor level picker is enabled/disabled. That is, whether the level picker will appear when a building with indoor maps is focused.

Returns
  • true if the level picker is enabled; false if the level picker is disabled.

public boolean isMapToolbarEnabled ()

Gets whether the Map Toolbar is enabled/disabled.

Returns
  • true if the Map Toolbar is enabled; false otherwise.

public boolean isMyLocationButtonEnabled ()

Gets whether the my-location button is enabled/disabled.

Returns
  • true if the my-location button is enabled; false if the my-location button is disabled.

public boolean isRotateGesturesEnabled ()

Gets whether rotate gestures are enabled/disabled.

Returns
  • true if rotate gestures are enabled; false if rotate gestures are disabled.

public boolean isScrollGesturesEnabled ()

Gets whether scroll gestures are enabled/disabled.

Returns
  • true if scroll gestures are enabled; false if scroll gestures are disabled.

public boolean isScrollGesturesEnabledDuringRotateOrZoom ()

Gets whether scroll gestures are enabled/disabled during rotation and zoom gestures.

Returns
  • true if scroll gestures are enabled during rotate or zoom gestures; false if scroll gestures are disabled during rotate or zoom gestures.

public boolean isTiltGesturesEnabled ()

Gets whether tilt gestures are enabled/disabled.

Returns
  • true if tilt gestures are enabled; false if tilt gestures are disabled.

public boolean isZoomControlsEnabled ()

Gets whether the zoom controls are enabled/disabled.

Returns
  • true if the zoom controls are enabled; false if the zoom controls are disabled;

public boolean isZoomGesturesEnabled ()

Gets whether zoom gestures are enabled/disabled.

Returns
  • true if zoom gestures are enabled; false if zoom gestures are disabled.

public void setAllGesturesEnabled (boolean enabled)

Sets the preference for whether all gestures should be enabled or disabled. If enabled, all gestures are available; otherwise, all gestures are disabled. This doesn't restrict users from tapping any on screen buttons to move the camera (e.g., compass or zoom controls), nor does it restrict programmatic movements and animation.

Parameters
enabled true to enable all gestures; false to disable all gestures.

public void 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).

Parameters
enabled true to enable the compass; false to disable the compass.

public void setIndoorLevelPickerEnabled (boolean enabled)

Sets whether the indoor level picker is enabled when indoor mode is enabled. If true, the level picker will appear when a building with indoor maps is focused. If false, no level picker will appear - an application will need to provide its own way of selecting levels. The default behaviour is to show the level picker.

Parameters
enabled true to show; false to hide the level picker.

public void setMapToolbarEnabled (boolean enabled)

Sets the preference for whether the Map Toolbar should be enabled or disabled. If enabled, and the Map Toolbar can be shown in the current context, users will see a bar with various context-dependent actions, including 'open this map in the Google Maps app' and 'find directions to the highlighted marker in the Google Maps app'.

By default, the Map Toolbar is enabled.

Parameters
enabled true to enable the Map Toolbar; false to disable the Map Toolbar.

public void 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).

Parameters
enabled true to enable the my-location button; false to disable the my-location button.

public void setRotateGesturesEnabled (boolean enabled)

Sets the preference for whether rotate gestures should be enabled or disabled. If enabled, users can use a two-finger rotate gesture to rotate the camera. If disabled, users cannot rotate the camera via gestures. This setting doesn't restrict the user from tapping the compass icon to reset the camera orientation, nor does it restrict programmatic movements and animation of the camera.

By default, rotate gestures are enabled.

Parameters
enabled true to enable rotate; false to disable rotate gestures.

public void setScrollGesturesEnabled (boolean enabled)

Sets the preference for whether scroll gestures should be enabled or disabled. If enabled, users can swipe to pan the camera. If disabled, swiping has no effect. This setting doesn't restrict programmatic movement and animation of the camera.

By default, scroll gestures are enabled.

Parameters
enabled true to enable scroll gestures; false to disable scroll gestures.

public void setScrollGesturesEnabledDuringRotateOrZoom (boolean enabled)

Sets the preference for whether scroll gestures can take place at the same time as a zoom or rotate gesture. If enabled, users can scroll the map while rotating or zooming the map. If disabled, the map cannot be scrolled while the user rotates or zooms the map using gestures. This setting doesn't disable scroll gestures entirely, only during rotation and zoom gestures, nor does it restrict programmatic movements and animation of the camera.

By default, scroll gestures are enabled during rotation and zoom.

Parameters
enabled true to enable scroll gestures during rotate or zoom gestures; false to disable scroll gestures during rotate or zoom gestures.

public void setTiltGesturesEnabled (boolean enabled)

Sets the preference for whether tilt gestures should be enabled or disabled. If enabled, users can use a two-finger vertical down swipe to tilt the camera. If disabled, users cannot tilt the camera via gestures. This setting doesn't restrict users from tapping the compass icon to reset the camera orientation, nor does it restrict programmatic movement and animation of the camera.

By default, tilt gestures are enabled.

Parameters
enabled true to enable tilt gestures; false to disable tilt gestures.

public void 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.

Parameters
enabled true to enable the zoom controls; false to disable the zoom controls.

public void setZoomGesturesEnabled (boolean enabled)

Sets the preference for whether zoom gestures should be enabled or disabled. If enabled, users can either double tap/two-finger tap or pinch to zoom the camera. If disabled, these gestures have no effect. This setting doesn't affect the zoom buttons, nor does it restrict programmatic movement and animation of the camera.

By default, zoom gestures are enabled.

Parameters
enabled true to enable zoom gestures; false to disable zoom gestures.