Android Map : How to cutomize Marker icon with SVG file?

1.2k Views Asked by At

I have a SGV icon (.svg) that I want to use like cutom icon for map markers.

How should I proceed ? I didn't find anything on the subject.

1

There are 1 best solutions below

3
Zholoth On

If the SVG is part of your resources, you could simply add it to MarkerOptions by calling

val svgIcon = BitmapDescriptorFactory.fromResource(R.drawable.your_svg_name_here)
val marker = MarkerOptions().position(LatLng(latitude, longitude)).icon(svgIcon)
googleMap?.addMarker(marker)

If it isn't in your resources, just use another method of the BitmapDescriptorFactory.