Vector graphics used for google map marker.

Is there a way to use vector graphics as a marker of Google Maps? I know that google maps have a bitmap for the marker, but I have vector graphics (coming from the server) and I'm not sure how to display this as a marker?

thanks

+5
source share
2 answers

Technically, if you can make your vector image as Drawable, you can use it as a map marker. Vector drawings on Android are complex, but you may have already solved this problem.

You need to programmatically create a recordable bitmap file with the required size (specify your constant size in the dips to adjust it to the screen density), create a canvas based on this bitmap, set the borders on your Drawable, then draw it on the Canvas. Then your Bitmap will contain the rendering of your Drawable, and you can create a marker from it.

+1
source

but i have a vector graphic file and i'm not sure how to do it?

Open it in a vector drawing application and export it as a bitmap (PNG) for use on Android. This is a less painful path than anything else.

0
source

All Articles