> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/android/maps/llms.txt)

# Set a style

When adding a map to an Android application using the Maps SDK, the map's style dictates the visual design of the map, including colors, labels, and feature visibility. It also includes information about data sources, and is used by the SDK to fetch the appropriate data necessary to render the map.

![An Android application displaying a map using the Mapbox Standard style.](https://docs.mapbox.com/android/assets/ideal-img/maps-guides-eiffel-standard-style.b389168.480.png)

![](https://docs.mapbox.com/android/assets/ideal-img/maps-guides-yosemite-outdoors-style.bd2e61e.480.png)

![](https://docs.mapbox.com/android/assets/ideal-img/maps-guides-mountains-3d-terrain.992438e.480.png)

By default the Maps SDK for Android uses the [Mapbox Standard](https://docs.mapbox.com/map-styles/standard/guides/) style, which is a versatile and visually appealing map style suitable for many applications. Mapbox Standard offers many [configuration options](https://docs.mapbox.com/map-styles/standard/api/#configuration-properties), allowing developers to customize the map's appearance to suit the needs of their application. If a completely unique look and feel is needed for the map, developers can create custom styles using [Mapbox Studio](https://docs.mapbox.com/studio-manual/), which can then be loaded into the map.

Once a style is loaded, you can continue to manipulate it at runtime, changing the appearance of the map by changing style configurations, adding or removing layers, changing layer properties, and more. This guide explains how to set and configure a style when initializing a map and how to switch styles dynamically during runtime.

## Load a style

The Maps SDK provides an embeddable map interface using [`MapView`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-map-view/) or [`MapboxMap`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.extension.compose/-mapbox-map.html). To render a map in the `MapView` or `MapboxMap`, you will need to determine which style the renderer should use. You can rely on the **Mapbox Standard** Style which is loaded by default, or you can specify another style.

### Mapbox Standard

[Mapbox Standard](https://docs.mapbox.com/map-styles/standard/) is our general-purpose map style that is designed to be used in a wide range of applications, suitable for most use cases and includes a variety of configuration options to customize the map's appearance.

Mapbox Standard is the default style, and instantiating a [`MapView`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-map-view/) or [`MapboxMap`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.extension.compose/-mapbox-map.html) without specifying any style means your map will use Mapbox Standard.

**Android View**

```kotlin
// Loads Mapbox Standard Style by default
mapView = MapView(context)
```

**Jetpack Compose**

```kotlin
// Loads Mapbox Standard Style by default
MapboxMap()
```

You can explicitly set Mapbox Standard as the style for your map by using the `Style.STANDARD` constant or calling `MapboxStandardStyle()` if you are using Jetpack Compose:

**Android View**

```kotlin
mapView = MapView(context, MapInitOptions(
  context = context,
  styleUri = Style.STANDARD
))
```

**Jetpack Compose**

```kotlin
MapboxMap(
  style = { MapboxStandardStyle() }
)
```

### Custom styles

You can also create your own custom styles using the Mapbox Studio style editor. Custom styles can be used to create a unique look and feel for your map, tailored to your application's design needs. You can use Mapbox Standard edited in Mapbox Studio or any other style as a base—or start from scratch entirely. Learn how to customize Standard in [this tutorial](https://docs.mapbox.com/help/tutorials/aa-standard-in-studio/), how to build a style from scratch [in this guide](https://docs.mapbox.com/help/dive-deeper/map-design/#how-to-create-a-custom-style) or explore our style [gallery](https://www.mapbox.com/gallery).

You can specify a style to use when you instantiate a map using a Style URL, a Style Constant, or a Style JSON string.

#### Load a style using a Style URL

All Mapbox styles and custom styles created in Mapbox Studio have a unique style URL starting with `mapbox://`. You can use this URL with the `styleUri` property of [`MapInitOptions`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-map-init-options/), or using `MapStyle` with Jetpack Compose.

**Android View**

```kotlin
mapView = MapView(context, MapInitOptions(
  context = context,
  styleUri = "mapbox://styles/your-mapbox-username/your-custom-style-url"
))
```

**Jetpack Compose**

```kotlin
MapboxMap(
  style = { MapStyle(style = "mapbox://styles/your-mapbox-username/your-custom-style-url") }
)
```

#### Load a Mapbox style using a Style Constant

If you are using a Mapbox-designed style, you can use [convenience variables](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-style/-companion/) instead of the full style URL. This will also make sure you're using the latest version of the style:

| Style Name | SDK Constant |
| --- | --- |
| Mapbox Standard | `Style.STANDARD` |
| Mapbox Standard Satellite | `Style.STANDARD_SATELLITE` |

**Android View**

```kotlin
mapView = MapView(context, MapInitOptions(
  context = context,
  styleUri = Style.OUTDOORS
))
```

**Jetpack Compose**

```kotlin
MapboxMap(
  style = { MapStyle(style = Style.OUTDOORS) }
)
```

> **Note: Loading a Style using Style JSON**
> 
> Though less common, you can also load a style from a JSON string, either loaded from a local file or downloaded over the network. See a minimal style JSON example in [Delay setting the style](#delay-setting-the-style) below.

### Delay setting the style

If you want to initialize the `MapView` but delay loading a style until after the MapView is displayed on the UI, you can set the `styleUri` to `null` in [`MapInitOptions`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-map-init-options/), or pass an empty string to `MapStyle` when using Jetpack Compose.

**Android View**

```kotlin
// set styleUri to null method
mapview = MapView(context, MapInitOptions(context = context, styleUri = null))
```

**Jetpack Compose**

```kotlin
MapboxMap(
  style = { 
    // load empty style
    MapStyle(style = "")
  }
)
```

In the case above, `MapView` is rendered with solid black background color by default. But, if you want to adjust the color of the map's background to fit your design before your style is loaded to the `MapView`, you can create a minimal style JSON string with a `background` layer set to the desired color.

**Android View**

```kotlin
@Language("JSON")
    private const val BLANK_STYLE = """
{
  "layers": [
    {
      "id": "background",
      "type": "background",
      "paint": {"background-color": "hsl(100, 50%, 50%)"}
    }
  ]
}
"""

MapView(context, MapInitOptions(context = context, styleUri = BLANK_STYLE))
// or
mapboxMap.loadStyle(BLANK_STYLE)
```

**Jetpack Compose**

```kotlin
@Language("JSON")
    private const val BLANK_STYLE = """
{
  "layers": [
    {
      "id": "background",
      "type": "background",
      "paint": {"background-color": "hsl(100, 50%, 50%)"}
    }
  ]
}
"""

MapboxMap(
  style = {
    // load custom blank style
    MapStyle(style = BLANK_STYLE)
  }
)
```

### Set a style in an XML MapView

If using Android Views, you can add a `MapView` to the layout with an XML attribute `mapbox_styleUri` to load a Mapbox-hosted style using a [style URL](https://docs.mapbox.com/help/glossary/style-url/).

```XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:mapbox="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- MapView for displaying the Mapbox map -->
    <com.mapbox.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        mapbox:mapbox_styleUri="mapbox://styles/your-mapbox-username/your-custom-style-url" />

</RelativeLayout>
```

## Configure a style

Depending on which map style you choose, you have different configuration options available to customize aspects of your style such as fonts, colors, and more.

### Mapbox Standard

**Mapbox Standard** and **Mapbox Standard Satellite** are our default, all-purpose map styles, and are recommended for most use cases. These styles provide a limited set of configurations instead of allowing for full manipulation of the style.

Each style can be configured with several options, including [light presets](https://docs.mapbox.com/map-styles/standard/guides/#light-presets), [label visibility](https://docs.mapbox.com/map-styles/standard/guides/#label-visibility), [feature visibility](https://docs.mapbox.com/map-styles/standard/guides/#feature-visibility), [color theming](https://docs.mapbox.com/map-styles/standard/guides/#theming), and [fonts](https://docs.mapbox.com/map-styles/standard/guides/#fonts), and more. You can set these at runtime using the [`setStyleImportConfigProperty`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-mapbox-style-manager/set-style-import-config-property.html) method.

> **Related content (playground): [Mapbox Standard Style Playground](https://docs.mapbox.com/playground/standard-style/)**
> 
> Using this interactive tool, you can see in real-time how different configuration options affect the Mapbox Standard or Mapbox Standard Satellite styles.

All configuration properties for Mapbox Standard are also available for Mapbox Standard Satellite except for toggling 3D objects and color theming. To learn more about configuration options, refer to the [Mapbox Standard Guide](https://docs.mapbox.com/map-styles/standard/guides/#configuration) and the [Mapbox Standard API Reference Docs](https://docs.mapbox.com/map-styles/standard/api/#configuration-properties).

The following sample code shows how to change the 3D lights from the default preset, `day`, to another preset, `dusk`, by setting the `lightPreset` property. The code also shows how to hide the point of interest labels by setting the `showPointOfInterestLabels` property to `false`.

When using Android Views, these configurations can be applied after the map loads by calling `getStyle` and then using the `setStyleImportConfigProperty` method. The first parameter for this method is the import id, which is `basemap` when using Mapbox Standard.

When using Jetpack Compose, you can set these configurations before the map loads using the `MapboxStandardStyle` block.

**Android View**

```kotlin
mapView = MapView(context)
mapView.mapboxMap.getStyle { style ->
  style.setStyleImportConfigProperty(
    "basemap", // Mapbox Standard's import id is "basemap"
    "lightPreset",
    Value.valueOf("dusk")
  )

  style.setStyleImportConfigProperty(
    "basemap",
    "showPointOfInterestLabels",
    Value.valueOf(false)
  )
}
```

**Jetpack Compose**

```kotlin
MapboxMap(
  style = {
    MapboxStandardStyle(
      standardStyleState = rememberStandardStyleState {
        configurationsState.apply {
          lightPreset = LightPresetValue.DUSK
          showPointOfInterestLabels = BooleanValue(false)
        }
      }
    )
  }
)
```

All configurations are also available in [Mapbox Studio](https://docs.mapbox.com/studio-manual/guides/map-styling/#the-style-editor), where you can create a custom style that imports Mapbox Standard or Mapbox Standard Satellite and adjust the configurations as needed.

### Custom styles

Custom styles can be configured by calling methods to update the properties of the style. The most common configurations are updates to layer properties, such as changing the color of a line or the visibility of a label.

For example, you may want to hide an existing layer by setting its `visibility` to `none`, or change the color of a `fill` layer by setting its `fill-color` property. Learn more about updating layers in the [Work with sources and layers](https://docs.mapbox.com/android/maps/guides/styles/work-with-layers/#update-a-layer-at-runtime) guide.

**Android View**

```kotlin
mapView.mapboxMap.getStyle { style ->
  style.setStyleLayerProperty("water", "fill-color", Value.valueOf("#45d9ca"))
}
```

**Jetpack Compose**

```kotlin
MapboxMap(
    style = { MapStyle(style = Style.MAPBOX_STREETS) },
) {
    MapEffect(Unit) { mapView ->
        mapView.mapboxMap.getStyle { style ->
            style.setStyleLayerProperty("water", "fill-color", Value.valueOf("#45d9ca"))
        }
    }
}
```

This approach requires knowing the ids and types of layers in the style and understanding the properties that can be updated for each layer type. You can explore the properties available for a given layer type in the [Mapbox Style Specification](https://docs.mapbox.com/style-spec/reference/).

An alternative approach to adding many runtime configuration changes for a style is to create a custom style in [Mapbox Studio](https://docs.mapbox.com/studio-manual/guides/map-styling/#the-style-editor). You can make the desired changes in the style editor and load the custom style in your application.

## Change to a different style

You can change the style any time after initializing the map using the `MapboxMap` [`loadStyle`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-mapbox-map/load-style.html) method.

**Android View**

```kotlin
mapView.mapboxMap.loadStyle("mapbox://styles/mapbox/standard-satellite")
```

**Jetpack Compose**

```kotlin
mapView.mapboxMap.loadStyle("mapbox://styles/mapbox/standard-satellite")
```

If you added any layers after map initialized, you will need to re-add them after the new style is loaded *or* use the [`addPersistentLayer`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.extension.style.layers/add-persistent-layer.html) method when adding any layers to the initial style.

For Jetpack Compose users, you can change the whole `MapboxStyleComposable` block to switch between customized styles or strongly typed `MapboxStandardStyle` or `MapboxStandardSatelliteStyle`. Layers added to `slot` or `layer position` of the `MapboxStyleComposable` will be added as normal layers once the style is loaded and layers added to the `MapboxMap` content will be added as persistent layer across different styles.