与Android的谷歌地图API V2文字多个标记多个、标记、文字、地图

2023-09-04 03:54:55 作者:贰柒.灭世

我的目标是有多个标记与Android的谷歌地图API的 V2 地图文本上的每个。信息窗口方法(showInfoWindow())是不适合的,因为只有一个信息窗口显示的时间。例如,我想有这样的事情:

My goal is to have multiple markers with text on each on the Android Google Maps API v2 map. The info windows approach (showInfoWindow()) is not suitable, because only one info window is displayed at a time. For example I want to have something like this:

正如你可以看到每个标志物都有自己的数据(号码为这个例子)显示所有的时间。 我怎样才能做到这一点与Android谷歌地图API的 V2

As you can see each marker has its own data (number for this example) displayed all the time. How can I achieve this with Android Google Maps API v2?

推荐答案

要做到这一点,你必须自定义每个单独标记的图标是你所需要的。 这里的链接:https://developers.google.com/maps/documentation/android/marker#customize_a_marker

to do that you'll have to customize the icon of each individual marker to be what you need. Here's the link: https://developers.google.com/maps/documentation/android/marker#customize_a_marker

然后你可以把一些PNG资源(蓝色,黄色和红色),并在运行时得到正确的位图,写一篇关于位图由code中的文本,然后设置为自定义标记与 fromBitmap(位图图像​​)方法。

Then you can put some PNG resources (a blue, a yellow and a red), and at runtime get correct Bitmap, write the text on the bitmap by code, and then set as the custom-marker with the fromBitmap (Bitmap image) method.