How to replace default info window marker with custom info window marker in map compose?

919 Views Asked by At

I would like to customise my info window marker of map in compose. My new info window marker is different in shape. I couldn't find proper solution to replace default one with new one.

2

There are 2 best solutions below

0
cmota On BEST ANSWER

This support is already available on the latest version of android-maps-compose. From the documentation, you can do something similar to:

MarkerInfoWindow(
    state = yourMarker,
    icon = yourMarkerIcon,
    title = yourMarkerTitle
) { marker ->
    // Implement the custom info window here
    Column {
        Text(marker.title ?: "Default Marker Title", color = Color.Red)
        Text(marker.snippet ?: "Default Marker Snippet", color = Color.Red)
    }
}
0
abrar ul haq On

Just sharing the updated answer, you can add you customized window in content parama

MarkerInfoWindow(
 state = yourMarker,
 title = yourMarkerTitle,
 icon = yourMarkerIcon,
 content = {
           // Implement the custom info window here
            Column {
            Text(marker.title ?: "Default Marker Title", color = Color.Red)
            Text(marker.snippet ?: "Default Marker Snippet", color = Color.Red)
           })