Search code examples
androidxamarinmapboxmapbox-android

How to put drawable for polyline pattern in Mapbox?


Just like for marker where we can put drawable for its icon, such as with Marker's .SetIcon(), how to do the same with Mapbox's polyline?

I've searched Google but, CMIIW, seems like there isn't a way to do that yet? Some links I think are related:

  1. Github - Dotted Polyline on Android
  2. Runtime Styling API

Any suggestion?


Solution

  • Unfortunately, Polyline doesn't support custom patterns. What I'd suggest is using LineLayer with PropertyFactory.linePattern() where you pass ID of an image previously added to the map via MapboxMap#addImage().

    Here is an example activity that uses LineLayer.