I have came up with this post but it is for the deprecated Google Maps API
http://tech.truliablog.com/2012/02/23/custom-map-markers-for-android-google-maps/
In the new API, I could not find an easy way to do this. In fact, I could not do it at all.
Basicly I want to have TextViews as a Marker on the map with 9Patch drawable as a background of the text. Trulia is still doing it with the new API v2 in their current app. You can check it here
How can I do this?
It can be simply achieved using this useful lib provided by google.
In style.xml
http://googlemaps.github.io/android-maps-utils/javadoc/
http://googlemaps.github.io/android-maps-utils/
https://github.com/googlemaps/android-maps-utils
you can set up upper links in your project from this link
Chris Broadfoot created a utility library that does exactly that.
The library is available here: https://github.com/googlemaps/android-maps-utils
Also see this short video: http://www.youtube.com/watch?v=nb2X9IjjZpM
by referring to Google's sample code
addIcon() Method here:
As far as I know, this is not currently supported by the google maps api v2. What you can do, on the other hand, is dynamically create the bitmap for your marker, and write the value you want to show in it. Alas, there may easily be performance issues if you happen to have plenty of pins.
Note that
bitmap
needs to be mutable. Also you will have to scale the base image (probably using a 9.patch) to your need.I know this question is old but I'll post my answer here in case it helps someone.
None of the above solutions were working for me because
I already have custom icons for markers in my app
My app display potentially thousands of different marker titles so creating that many images in memory would be a performance problem
As the marker icons become bigger, the map becomes very quickly unreadable
I found no solution on the internet so I rolled up my sleeves and made this library which solves my problem, hopefully it will help others too:
https://github.com/androidseb/android-google-maps-floating-marker-titles
Here is a preview of how it works: