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 the uiZoomControls
attribute of the namespace map. The value of this attribute should be Boolean. To disable it, set it as false
.
Similarly, the attributes for other UI controls and gestures are as follows:
Property |
Attribute... |
---|