Tim Nuwin Tim Nuwin - 3 months ago 27
Android Question

Mapbox Android, How to add a button to a Marker

I am using the Mapbox Android SDK and I was wondering how you can add a button associated with a Marker pop-up.

Edit

enter image description here

Answer

You can do this by creating your own info window adapter, An example doing this can be found in the demo app here. Important code to use:

mapboxMap.setInfoWindowAdapter(new MapboxMap.InfoWindowAdapter() {
      @Nullable
      @Override
      public View getInfoWindow(@NonNull Marker marker) {

      ...

      // return the view which includes the button

      }
});
Comments