Skip to main content

Map styles

Contents

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="Day" />

        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Night" />

        <Button
            android:onClick="onClickChangeStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Satellite" />
    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

SampleChangeStylesActivity.java

Last updated May 1, 2024.
Contents