Skip to main content

Map styles

Contents

The Mobile Maps SDK examples require that you first complete the initial project set-up.

Set the map to night, day, or satellite.

Map Styles

activity_sample_change_styles.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.trimblemaps.mapsdk.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <LinearLayout
        android:id="@+id/linearLayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent">

        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Mobile_Day"
            tools:ignore="HardcodedText" />

        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Mobile_Night"
            tools:ignore="HardcodedText" />

        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Mobile_Satellite"
            tools:ignore="HardcodedText" />
        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Terrain"
            tools:ignore="HardcodedText" />
        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Transportation"
            tools:ignore="HardcodedText" />
        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Basic"
            tools:ignore="HardcodedText" />
        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="DataDark"
            tools:ignore="HardcodedText" />
        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="DataLight"
            tools:ignore="HardcodedText" />
        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Default"
            tools:ignore="HardcodedText" />
        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Mobile_Default"
            tools:ignore="HardcodedText" />
        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Satellite"
            tools:ignore="HardcodedText" />
    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

SampleChangeStylesActivity.java

Before running the Java or Kotlin code, the theme needs to be set in the Theme.xml file as shown below.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.AsyncAcctInit" parent="Theme.AppCompat" />
</resources>
Last updated August 29, 2024.
Contents