GoogleMapOptions

public final classGoogleMapOptionsextendsObject
implementsParcelableParcelable

Defines configuration GoogleMapOptions for aGoogleMap.These options can be used when adding a map to your application programmatically (as opposed to via XML). If you are using aMapFragment,you can pass these options in using the static factory method MapFragment.newInstance(GoogleMapOptions).If you are using aMapView,you can pass these options in using the constructor MapView.MapView(Context, GoogleMapOptions).

If you add a map using XML, then you can apply these options using custom XML tags.

Inherited Constant Summary

Public Constructor Summary

GoogleMapOptions()
Creates a new GoogleMapOptions object.

Public Method Summary

GoogleMapOptions
ambientEnabled(boolean enabled)
Specifies whether ambient-mode styling should be enabled.
GoogleMapOptions
backgroundColor(Integer backgroundColor)
Sets the map background color.
GoogleMapOptions
camera(CameraPosition camera)
Specifies the initial camera position for the map (specify null to use the default camera position).
GoogleMapOptions
compassEnabled(boolean enabled)
Specifies whether the compass should be enabled.
staticGoogleMapOptions
createFromAttributes(Context context,AttributeSet attrs)
Creates aGoogleMapsOptionsfrom theAttributeSet.
Boolean
getAmbientEnabled()
Returns theambientEnabledoption, ornullif unspecified.
Integer
getBackgroundColor()
Returns the currentbackgroundColorfor the map, or nullif unspecified.
CameraPosition
getCamera()
Returns the camera option, ornullif unspecified.
Boolean
getCompassEnabled()
Returns thecompassEnabledoption, ornullif unspecified.
LatLngBounds
getLatLngBoundsForCameraTarget()
Returns theLatLngBoundsused to constrain the camera target, or nullif unspecified.
Boolean
getLiteMode()
Returns theliteModeoption, ornullif unspecified.
int
getMapColorScheme()
Returns themapColorSchemeoption, orScheme.LIGHT default if unspecified.
String
getMapId()
Returns themapId,ornullif unspecified.
Boolean
getMapToolbarEnabled()
Returns themapToolbarEnabledoption, ornullif unspecified.
int
getMapType()
Returns themapTypeoption, or-1if unspecified.
Float
getMaxZoomPreference()
Returns the maximum zoom level preference, ornullif unspecified.
Float
getMinZoomPreference()
Returns the minimum zoom level preference, ornullif unspecified.
Boolean
getRotateGesturesEnabled()
Returns therotateGesturesEnabledoption, ornullif unspecified.
Boolean
getScrollGesturesEnabled()
Returns thescrollGesturesEnabledoption, ornullif unspecified.
Boolean
getScrollGesturesEnabledDuringRotateOrZoom()
Returns thescrollGesturesEnabledDuringRotateOrZoomoption, or nullif unspecified.
Boolean
getTiltGesturesEnabled()
Returns thetiltGesturesEnabledoption, ornullif unspecified.
Boolean
getUseViewLifecycleInFragment()
Returns theuseViewLifecycleInFragmentoption, or nullif unspecified.
Boolean
getZOrderOnTop()
Returns thezOrderOnTopoption, ornullif unspecified.
Boolean
getZoomControlsEnabled()
Returns thezoomControlsEnabledoption, ornullif unspecified.
Boolean
getZoomGesturesEnabled()
Returns thezoomGesturesEnabledoption, ornullif unspecified.
GoogleMapOptions
latLngBoundsForCameraTarget(LatLngBounds llbounds)
Specifies a LatLngBounds to constrain the camera target, so that when users scroll and pan the map, the camera target does not move outside these bounds.
GoogleMapOptions
liteMode(boolean enabled)
Specifies whether the map should be created in lite mode.
GoogleMapOptions
mapColorScheme(int mapColorScheme)
Specifies a change to the initial map color scheme, default is MapColorScheme.LIGHT.
GoogleMapOptions
mapId(StringmapId)
Specifies the map's ID.
GoogleMapOptions
mapToolbarEnabled(boolean enabled)
Specifies whether the mapToolbar should be enabled.
GoogleMapOptions
mapType(int mapType)
Specifies a change to the initial map type.
GoogleMapOptions
maxZoomPreference(float maxZoomPreference)
Specifies a preferred upper bound for camera zoom.
GoogleMapOptions
minZoomPreference(float minZoomPreference)
Specifies a preferred lower bound for camera zoom.
GoogleMapOptions
rotateGesturesEnabled(boolean enabled)
Specifies whether rotate gestures should be enabled.
GoogleMapOptions
scrollGesturesEnabled(boolean enabled)
Specifies whether scroll gestures should be enabled.
GoogleMapOptions
scrollGesturesEnabledDuringRotateOrZoom(boolean enabled)
Specifies whether scroll gestures should be enabled during rotate and zoom gestures.
GoogleMapOptions
tiltGesturesEnabled(boolean enabled)
Specifies whether tilt gestures should be enabled.
String
GoogleMapOptions
useViewLifecycleInFragment(boolean useViewLifecycleInFragment)
When using aMapFragment, this flag specifies whether the lifecycle of the map should be tied to the fragment's view or the fragment itself.
void
writeToParcel(Parcelout, int flags)
GoogleMapOptions
zOrderOnTop(boolean zOrderOnTop)
Control whether the map view's surface is placed on top of its window.
GoogleMapOptions
zoomControlsEnabled(boolean enabled)
Specifies whether the zoom controls should be enabled.
GoogleMapOptions
zoomGesturesEnabled(boolean enabled)
Specifies whether zoom gestures should be enabled.

Inherited Method Summary

Public Constructors

publicGoogleMapOptions()

Creates a new GoogleMapOptions object.

Public Methods

publicGoogleMapOptions ambientEnabled(boolean enabled)

Specifies whether ambient-mode styling should be enabled. The default value is false.When enabled, ambient-styled maps can be displayed when an Ambiactive device enters ambient mode.

publicGoogleMapOptions backgroundColor(Integer backgroundColor)

Sets the map background color. This is the color that shows underneath map tiles and displays whenever the renderer does not have a tile available for a portion of the viewport.

Parameters
backgroundColor the color to show in the background of the map. Ifnullis supplied then the map uses the default renderer background color.

publicGoogleMapOptions camera(CameraPosition camera)

Specifies the initial camera position for the map (specify null to use the default camera position).

publicGoogleMapOptions compassEnabled(boolean enabled)

Specifies whether the compass should be enabled. See UiSettings.setCompassEnabled(boolean)for more details. The default value is true.

public staticGoogleMapOptions createFromAttributes(Contextcontext, AttributeSet attrs)

Creates aGoogleMapsOptionsfrom theAttributeSet.

publicBooleangetAmbientEnabled()

Returns theambientEnabledoption, ornullif unspecified.

publicIntegergetBackgroundColor()

Returns the currentbackgroundColorfor the map, ornull if unspecified.

publicCameraPosition getCamera()

Returns the camera option, ornullif unspecified.

publicBooleangetCompassEnabled()

Returns thecompassEnabledoption, ornullif unspecified.

publicLatLngBounds getLatLngBoundsForCameraTarget()

Returns theLatLngBoundsused to constrain the camera target, or nullif unspecified.

publicBooleangetLiteMode()

Returns theliteModeoption, ornullif unspecified.

public intgetMapColorScheme()

Returns themapColorSchemeoption, orScheme.LIGHTdefault if unspecified.

publicStringgetMapId()

Returns themapId,ornullif unspecified.

publicBooleangetMapToolbarEnabled()

Returns themapToolbarEnabledoption, ornullif unspecified.

public intgetMapType()

Returns themapTypeoption, or-1if unspecified.

publicFloatgetMaxZoomPreference()

Returns the maximum zoom level preference, ornullif unspecified.

publicFloatgetMinZoomPreference()

Returns the minimum zoom level preference, ornullif unspecified.

publicBooleangetRotateGesturesEnabled()

Returns therotateGesturesEnabledoption, ornullif unspecified.

publicBooleangetScrollGesturesEnabled()

Returns thescrollGesturesEnabledoption, ornullif unspecified.

publicBooleangetScrollGesturesEnabledDuringRotateOrZoom()

Returns thescrollGesturesEnabledDuringRotateOrZoomoption, or nullif unspecified.

publicBooleangetTiltGesturesEnabled()

Returns thetiltGesturesEnabledoption, ornullif unspecified.

publicBooleangetUseViewLifecycleInFragment()

Returns theuseViewLifecycleInFragmentoption, ornullif unspecified.

publicBooleangetZOrderOnTop()

Returns thezOrderOnTopoption, ornullif unspecified.

publicBooleangetZoomControlsEnabled()

Returns thezoomControlsEnabledoption, ornullif unspecified.

publicBooleangetZoomGesturesEnabled()

Returns thezoomGesturesEnabledoption, ornullif unspecified.

publicGoogleMapOptions latLngBoundsForCameraTarget(LatLngBounds llbounds)

Specifies a LatLngBounds to constrain the camera target, so that when users scroll and pan the map, the camera target does not move outside these bounds.

See GoogleMap.setLatLngBoundsForCameraTarget(LatLngBounds)for details.

publicGoogleMapOptions liteMode(boolean enabled)

Specifies whether the map should be created in lite mode. The default value is false.If lite mode is enabled, maps will load as static images. This improves performance in the case where a lot of maps need to be displayed at the same time, for example in a scrolling list, however lite-mode maps cannot be panned or zoomed by the user, or tilted or rotated at all.

publicGoogleMapOptions mapColorScheme(int mapColorScheme)

Specifies a change to the initial map color scheme, default is MapColorScheme.LIGHT.

publicGoogleMapOptions mapId(StringmapId)

Specifies the map's ID.

publicGoogleMapOptions mapToolbarEnabled(boolean enabled)

Specifies whether the mapToolbar should be enabled. See UiSettings.setMapToolbarEnabled(boolean)for more details. The default value istrue.

publicGoogleMapOptions mapType(int mapType)

Specifies a change to the initial map type.

publicGoogleMapOptions maxZoomPreference(float maxZoomPreference)

Specifies a preferred upper bound for camera zoom.

See GoogleMap.setMaxZoomPreference(float)for details.

publicGoogleMapOptions minZoomPreference(float minZoomPreference)

Specifies a preferred lower bound for camera zoom.

See GoogleMap.setMinZoomPreference(float)for details.

publicGoogleMapOptions rotateGesturesEnabled(boolean enabled)

Specifies whether rotate gestures should be enabled. See UiSettings.setRotateGesturesEnabled(boolean)for more details. The default value istrue.

publicGoogleMapOptions scrollGesturesEnabled(boolean enabled)

Specifies whether scroll gestures should be enabled. See UiSettings.setScrollGesturesEnabled(boolean)for more details. The default value istrue.

publicGoogleMapOptions scrollGesturesEnabledDuringRotateOrZoom (boolean enabled)

Specifies whether scroll gestures should be enabled during rotate and zoom gestures. See UiSettings.setScrollGesturesEnabledDuringRotateOrZoom(boolean)for more details. The default value istrue.

publicGoogleMapOptions tiltGesturesEnabled(boolean enabled)

Specifies whether tilt gestures should be enabled. See UiSettings.setTiltGesturesEnabled(boolean)for more details. The default value istrue.

publicStringtoString()

publicGoogleMapOptions useViewLifecycleInFragment(boolean useViewLifecycleInFragment)

When using aMapFragment, this flag specifies whether the lifecycle of the map should be tied to the fragment's view or the fragment itself. The default value isfalse,tying the lifecycle of the map to the fragment.

Using the lifecycle of the fragment allows faster rendering of the map when the fragment is detached and reattached, because the underlying GL context is preserved. This has the cost that detaching the fragment, but not destroying it, will not release memory used by the map.

Using the lifecycle of a fragment's view means that a map is not reused when the fragment is detached and reattached. This will cause the map to re-render from scratch, which can take a few seconds. It also means that while a fragment is detached, and therefore has no view, allGoogleMap methods will throwNullPointerException.

public voidwriteToParcel(Parcelout, int flags)

publicGoogleMapOptions zOrderOnTop(boolean zOrderOnTop)

Control whether the map view's surface is placed on top of its window. See SurfaceView.setZOrderOnTop(boolean)for more details. Note that this will cover all other views that could appear on the map (e.g., the zoom controls, the my location button).

publicGoogleMapOptions zoomControlsEnabled(boolean enabled)

Specifies whether the zoom controls should be enabled. See UiSettings.setZoomControlsEnabled(boolean)for more details. The default value istrue.

publicGoogleMapOptions zoomGesturesEnabled(boolean enabled)

Specifies whether zoom gestures should be enabled. See UiSettings.setZoomGesturesEnabled(boolean)for more details. The default value istrue.