gpt4 book ai didi

android - Google Maps V2 android 获取标记图标

转载 作者:搜寻专家 更新时间:2023-11-01 08:54:27 24 4
gpt4 key购买 nike

我目前正在实现 GoogleMapsV2 并尝试移植我在 MapsV1 中的旧功能。在 V1 中,我能够继承一个 OverlayItem并保存我放在里面的图标。现在我必须创建一个 MarkerOption基于模型对象,将其添加到 GoogleMap取回标记。

因为 Marker 类是最终类,而 GoogleMaps 没有提供方法来处理它(如 SQLiteCursorFactory ),我觉得无法取回我放入其中的图标。

如果我保留 MarkerOptions对象,我可以找回 BitmapDescriptor它只有一个(混淆)方法 aW()这是返回 b目的。

我很确定位图一定在这个对象的某个地方,因为它绘制在 GoogleMap 上.从标记中取回它的最佳方法是什么。

我目前正在将标记映射到我在 HashMap<Marker, ModelObj> 中创建的模型但是每次我想访问它时,我都必须从那里重新创建图标。这感觉完全不对,我想知道是否有更好的访问方法。

最佳答案

I'm quite shure that the Bitmap must be somewhere inside this object because its drawn on the GoogleMap.

这远非确定。 map 由另一个进程呈现。因此,虽然 Bitmap那个进程中,但它可能不在你的进程中。

What is the best way to get it back from the marker.

你不知道。这是一个只写 API。

I'm currently mapping the Marker to my model upon creation inside a HashMap but from there I have to re-create the icon everytime I want to access it.

然后自己缓存。现在,MarkergetId(),这可能比使用Marker 本身作为键要好。但是,要么将您的图标放入 ModelObj 中,要么使用单独的位图缓存。您必须自己确定 CPU 与 RAM 的权衡是否值得缓存或重新生成图标。

关于android - Google Maps V2 android 获取标记图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20075731/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com