MapStyleOptions

  • MapStyleOptions defines styling options for a GoogleMap.

  • Style options allow customization of the visual display of map features like roads, parks, and points of interest, and can also hide features entirely.

  • Map style options can be created from a JSON styling string or loaded from a raw resource identifier.

  • MapStyleOptions implements the Parcelable interface, allowing it to be written to and read from a Parcel.

public final classMapStyleOptions extendsObject
implementsParcelable

Defines styling options for aGoogleMap.

With style options you can customize the presentation of the standard Google map styles, changing the visual display of features like roads, parks, and other points of interest. As well as changing the style of these features, you can also hide features entirely. This means that you can emphasize particular components of the map or make the map complement the content of your app.

Developer Guide

For more information, read thedeveloper guide.

Inherited Constant Summary

From interface android.os.Parcelable
intCONTENTS_FILE_DESCRIPTOR
intPARCELABLE_WRITE_RETURN_VALUE

Public Constructor Summary

MapStyleOptions(String json)
Creates a new set of map style options based on the given JSON styling string.

Public Method Summary

staticMapStyleOptions
loadRawResourceStyle(Context clientContext, int resourceId)
Creates a new set of map style options based on the a JSON styling string loaded from a raw resource identifier.
void
writeToParcel(Parcel out, int flags)

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
From interface android.os.Parcelable
abstract int
describeContents()
abstract void
writeToParcel(Parcel arg0, int arg1)

Public Constructors

publicMapStyleOptions(String json)

Creates a new set of map style options based on the given JSON styling string.

Parameters
jsonThe JSON string containing map style options. Must not benull.

Public Methods

public staticMapStyleOptionsloadRawResourceStyle(Context clientContext, int resourceId)

Creates a new set of map style options based on the a JSON styling string loaded from a raw resource identifier.

Parameters
clientContextClient context for the supplied resourceId.
resourceIdId of a raw resource containing the styling JSON.
Returns
  • A reference to this MapStyleOptions to allow call chaining.
Throws
if resourceId is not a valid raw resource id or the resource could not be read.
Resources.NotFoundException

public voidwriteToParcel(Parcel out, int flags)

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.