I use dynamic icon for each cluster item , so I have special icon url and load marker icon from url . I user following code :
override fun onBeforeClusterItemRendered(item: T, markerOptions: MarkerOptions?) {
super.onBeforeClusterItemRendered(item, markerOptions)
try {
var url = URL("https://cdn3.iconfinder.com/data/icons/places/100/map_pin_big_1-128.png")
Glide.with(context)
.asBitmap()
.load(url)
.into(object : CustomTarget<Bitmap>() {
override fun onLoadCleared(placeholder: Drawable?) {
}
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
markerOptions?.icon(BitmapDescriptorFactory.fromBitmap(resource))
}
})
} catch (ex: Exception) {
Log.e("map", ex.toString())
}
}
some icons still default in my case, after zoom in zoom out icon changes sometimes. The problem is that this code is not works for every cluster item , after zoom changed cluster icon is changed too, it may render my custom icon and may use default.