标记在谷歌地图api v2标记的顶部 [英] Label at the top of the marker in google maps api v2

查看:197
本文介绍了标记在谷歌地图api v2标记的顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

另外一个问题是切换到地图api v2。
这是我想达到的丑陋表现。



Edit1。可以有几个标记,每个标记都有自己的标签。所有标记和标签都会同时显示。





正如您所看到的,标记顶部有一个标签,其中包含一些信息。
使用api v1时,可以使用 Overlay 中的绘图标记和标签轻松完成。



我可以使用api v2来实现它吗?

第一个想法是将标记(红色)和标签(黑色)呈现为一个位图并将其设置为标记。但它会显着增加标记区域(红色矩形),并且使用标记限制让我真正头疼,用户可以映射交互实现。

第二个想法是使用 GroundOverlay ,但乍一看,它不是为此设计的。

Edit2 这里是类似的问题,解决方案,就像在第一个想法中一样,是使用标记和标签作为单个标记位图,从视图创建。 方案

看看我工作的图书馆:
googlemaps / android-maps-utils



您可以使用

  IconGenerator factory = new IconGenerator(this); 
位图图标= factory.makeIcon(11:15 1.08.2013​​);

mMap.addMarker(new MarkerOptions()。position(...)。
图标(BitmapDescriptorFactory.fromBitmap(icon)));


One more problem while switching to the maps api v2. This is an ugly representation of what i want to achieve.

Edit1. There can be several markers, every marker with its own label. All markers and labels are shown simultaneously.

As you can see there is a label with some information at the top of the marker. While using api v1 it can easily be done with drawing marker and label on Overlay.

How can I implement it using api v2?

The first idea is to render marker(red) and label(black) to one bitmap and set it as marker. But it will significantly increase marker area(red rectangle) and with this marker limitation gives me real headache with user to map interraction realisation.

The second idea is to use GroundOverlay, but at first glance, it is not designed for this purpose.

Edit2 Here is similar question, solution, like in the first idea, is to use both marker and label as single marker bitmap, created from view.

解决方案

Have a look at a library I am working on: googlemaps/android-maps-utils

You can use the BubbleIconFactory to achieve this:

IconGenerator factory = new IconGenerator(this);
Bitmap icon = factory.makeIcon("11:15 1.08.2013");

mMap.addMarker(new MarkerOptions().position(...).
    icon(BitmapDescriptorFactory.fromBitmap(icon)));

这篇关于标记在谷歌地图api v2标记的顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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