2

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

Dika
  • 2,213
  • 4
  • 33
  • 49

1 Answers1

0

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.

Łukasz Paczos
  • 597
  • 3
  • 9
  • thank you.. it works. they should be add this code somewhere at the docs – Dika Aug 07 '18 at 10:56
  • 7
    `ZoomButtonsController` [deprecated](https://github.com/mapbox/mapbox-gl-native/pull/13197) in `v6.7.0` and [removed](https://github.com/mapbox/mapbox-gl-native/pull/13198) in `v7.0.0`. – AST Jul 05 '19 at 18:11