2
votes

I just start today using mapbox for android. I want to display zoom control on mapbox mapview. I did a little research, the method should be setZoomControlsEnabled. but I dont know how to use this method on mapbox android sdk v6.3.0. the documentation pretty clear: https://www.mapbox.com/android-docs/api/map-sdk/6.3.0/index.html?com/mapbox/mapboxsdk/maps/UiSettings.html . But how I can use it?

another info about setZoomControlsEnabled, it should be a method of mapView class and can be called like this:

mapView.setZoomControlsEnabled

but I tried and it doesn't work. a github link as reference: https://github.com/mapbox/mapbox-gl-native/issues/2537

1
I dont understand why someone downvoted question like this. I guarantee no one can found a code example about this anywhereDika
ok, thank you @P-ZenkerDika
@P-Zenker Your link says "We couldn’t find any code matching setZoomControlsEnabled"!roghayeh hosseini

1 Answers

0
votes

You can use MapboxMap object get the reference to the UiSettings:

mapView.getMapAsync(mapboxMap -> {
  mapboxMap.getUiSettings().setZoomControlsEnabled(true);
}

or use the XML attributes:

<com.mapbox.mapboxsdk.maps.MapView
    android:id="@id/mapView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:mapbox_uiZoomControls="true" />

Also, check out the first steps and docs.