MapStyleOptions
Stay organized with collections
Save and categorize content based on your preferences.
Defines styling options for a GoogleMap
.
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 the developer guide.
Inherited Constant Summary
From interface android.os.Parcelable
int |
CONTENTS_FILE_DESCRIPTOR |
|
int |
PARCELABLE_WRITE_RETURN_VALUE |
|
Public Constructor Summary
|
MapStyleOptions( String json)
Creates a new set of map style options based on the given JSON styling string.
|
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
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
public MapStyleOptions (String json)
Creates a new set of map style options based on the given JSON styling string.
Parameters
json |
The JSON string containing map style options. Must not be
null . |
Public Methods
public static MapStyleOptions
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.
Parameters
clientContext |
Client context for the supplied resourceId. |
resourceId |
Id of a raw resource containing the styling JSON. |
Returns
- A reference to this MapStyleOptions to allow call chaining.
public void writeToParcel (Parcel out, int
flags)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eMapStyleOptions\u003c/code\u003e allows customization of Google Maps styles, impacting the visual display of features like roads and parks.\u003c/p\u003e\n"],["\u003cp\u003eYou can change the style of map features or hide them completely to emphasize specific elements or complement your app's content.\u003c/p\u003e\n"],["\u003cp\u003eStyle options are defined using a JSON string, which can be loaded from a raw resource or directly passed as a string.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eloadRawResourceStyle\u003c/code\u003e and the constructor are the primary methods to create \u003ccode\u003eMapStyleOptions\u003c/code\u003e instances.\u003c/p\u003e\n"]]],[],null,["# MapStyleOptions\n\npublic final class **MapStyleOptions** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nimplements [Parcelable](//developer.android.com/reference/android/os/Parcelable.html) \nDefines styling options for a [GoogleMap](/android/reference/com/google/android/gms/maps/GoogleMap).\n\nWith style options you can customize the presentation of the standard Google map styles,\nchanging the visual display of features like roads, parks, and other points of interest. As\nwell as changing the style of these features, you can also hide features entirely. This means\nthat you can emphasize particular components of the map or make the map complement the\ncontent of your app.\n\n### Developer Guide\n\nFor more information, read the [developer guide](//developers.google.com/maps/documentation/android-sdk/styling). \n\n### Inherited Constant Summary\n\nFrom interface android.os.Parcelable \n\n|-----|-------------------------------|---|\n| int | CONTENTS_FILE_DESCRIPTOR | |\n| int | PARCELABLE_WRITE_RETURN_VALUE | |\n\n### Public Constructor Summary\n\n|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [MapStyleOptions](/android/reference/com/google/android/gms/maps/model/MapStyleOptions#MapStyleOptions(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) json) Creates a new set of map style options based on the given JSON styling string. |\n\n### Public Method Summary\n\n|------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [MapStyleOptions](/android/reference/com/google/android/gms/maps/model/MapStyleOptions) | [loadRawResourceStyle](/android/reference/com/google/android/gms/maps/model/MapStyleOptions#loadRawResourceStyle(android.content.Context,%20int))([Context](//developer.android.com/reference/android/content/Context.html) clientContext, int resourceId) Creates a new set of map style options based on the a JSON styling string loaded from a raw resource identifier. |\n| void | [writeToParcel](/android/reference/com/google/android/gms/maps/model/MapStyleOptions#writeToParcel(android.os.Parcel,%20int))([Parcel](//developer.android.com/reference/android/os/Parcel.html) out, int flags) |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface android.os.Parcelable \n\n|---------------|--------------------------------------------------------------------------------------------------|\n| abstract int | describeContents() |\n| abstract void | writeToParcel([Parcel](//developer.android.com/reference/android/os/Parcel.html) arg0, int arg1) |\n\nPublic Constructors\n-------------------\n\n#### public **MapStyleOptions** ([String](//developer.android.com/reference/java/lang/String.html) json)\n\nCreates a new set of map style options based on the given JSON styling string. \n\n##### Parameters\n\n| json | The JSON string containing map style options. Must not be `null`. |\n|------|-------------------------------------------------------------------|\n\nPublic Methods\n--------------\n\n#### public static [MapStyleOptions](/android/reference/com/google/android/gms/maps/model/MapStyleOptions)\n**loadRawResourceStyle** ([Context](//developer.android.com/reference/android/content/Context.html) clientContext, int resourceId)\n\nCreates a new set of map style options based on the a JSON styling string loaded\nfrom a raw resource identifier. \n\n##### Parameters\n\n| clientContext | Client context for the supplied resourceId. |\n| resourceId | Id of a raw resource containing the styling JSON. |\n|---------------|---------------------------------------------------|\n\n##### Returns\n\n- A reference to this MapStyleOptions to allow call chaining. \n\n##### Throws\n\n| | if resourceId is not a valid raw resource id or the resource could not be read. |\n| [Resources.NotFoundException](//developer.android.com/reference/android/content/res/Resources.NotFoundException.html) | |\n|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|\n\n#### public void **writeToParcel** ([Parcel](//developer.android.com/reference/android/os/Parcel.html) out, int flags)"]]