Skip to main content

Restrict Interaction

Contents

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

Restrict the map to a certain geographic area, based on a bounding box of coordinates. The user can zoom in and out of that bounded area, but can only pan to just beyond it. If Toggle Gestures is displayed on the map, the user will not be able to interact with the map at all.

Restrict Interaction

activity_sample_restrict_user_interaction.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent">
<com.trimblemaps.mapsdk.maps.MapView android:id="@+id/mapView" android:layout_width="match_parent" android:layout_height="match_parent"/>
<Button android:id="@+id/btn_toggleAllowGestures" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Toggle Gestures"/>
</FrameLayout>

Sample Code

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 September 3, 2024.
Contents