2
votes

I have been using Mapbox in a recent project of mine and I was just wondering if it possible to customize the default marker information box.

Mapbox Information box

I was hoping there was a way use a custom xml layout so that I would be able to add other assets to the information box (Images, icons, etc). I have done a little bit of looking around but I cannot seem to see any references to this being done, is it something Mapbox supports?

Thanks in advanced.

Edit: Question may have been a little pre-emptive found this https://www.mapbox.com/android-sdk/api/2.2.0/com/mapbox/mapboxsdk/views/MapView.InfoWindowAdapter.html

1

1 Answers

3
votes

First, you are using a really old version of our SDK, please update to either 4.1.1 or 4.2.0-beta.5 for better performance along with new features an abundance of bug fixes.

You'll find this example useful for creating a custom info window.

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

            // return your info window view. 

            return view
          }
});