Disabling/Enabling UI controls and gestures with XML attributes

Until now, we have learned how to disable UI controls and gestures programmatically using the UiSettings class. Now, let's take a look at how we can disable these UI controls using the XML attributes in our layout file.

Till this point, we've used the following layout code:

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:name="com.google.android.gms.maps.MapFragment" />

To use the XML attributes, we need to add a namespace declaration:

xmlns:map="http://schemas.android.com/apk/res-auto"

To disable the zoom controls, we can use ...

Get Learning Android Google Maps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.