I'm using the Google maps utility library to generate an icon for my markers, and the setColor is not working, every color I set, is a different shade of blue, it's not my color, and it's also got a black stroke around, which I don't want.
this is the code:
for (place in location.locations) {
val locationPoz = LatLng(place.lat, place.long)
boundsBuilder.include(locationPoz)
//Here is the icon part
val icon = IconGenerator(requireContext())
icon.setColor(R.color.red)
val fIcon = icon.makeIcon("${place.price}€")
val marker = MarkerOptions()
.position(locationPoz)
.title(place.name)
.icon(BitmapDescriptorFactory.fromBitmap(fIcon))
.alpha(5f)
googleMap.addMarker(marker)
}
And this is how my map looks
CodePudding user response:
I think you can only use one of the provided values in https://googlemaps.github.io/android-maps-utils/javadoc/com/google/maps/android/ui/IconGenerator.html
Try
~icon.setColor(IconGenerator.STYLE_RED)
~
EDIT: I misread, I think. The STYLE_* values would have to be used like
icon.setStyle(IconGenerator.STYLE_RED)
That doesn't yet solve your problem of the border you don't want, so instead, you would need to provide your own background drawable with setBackground