Disabling/enabling the UI controls and gestures with the GoogleMapOptions object

Until now, we've added MapFragment directly in our layout and used the UiSettings class to change the controls. In Chapter 2, Configuring an API Key and Creating Our First Map Application, we learned how to add MapFragment dynamically in FrameLayout. Let's now discuss how to disable UI controls and gestures using the GoogleMapOptions object for a dynamically added fragment.

Our layout code is as follows:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" ...

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.