Skip to main content

Trimble layers

Contents

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

Add specialized layers to the map, ranging from weather alerts to 3D buildings.

Trimble Layers

activity_sample_trimble_layers.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="onClickToggleTrimbleLayer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Traffic" />

        <Button
            android:onClick="onClickToggleTrimbleLayer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="3D Buildings" />

        <Button
            android:onClick="onClickToggleTrimbleLayer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="POIs" />
        <Button
            android:onClick="onClickToggleTrimbleLayer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Weather" />

    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

SampleTrimbleLayersActivity.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 30, 2024.
Contents