与Android的谷歌地图API V2文字多个标记 [英] Multiple markers with text on Android Google Maps API v2

查看:250
本文介绍了与Android的谷歌地图API V2文字多个标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是有多个标记与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?

推荐答案

要做到这一点,你必须自定义每个单独标记的图标是你所需要的。 这里的链接:<一href="https://developers.google.com/maps/documentation/android/marker#customize_a_marker">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.

这篇关于与Android的谷歌地图API V2文字多个标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆