如何将按钮添加到API v2 Google地图标记(How to add a button to a API v2 Google Maps marker)

编程入门 行业动态 更新时间:2024-10-25 13:30:24
如何将按钮添加到API v2 Google地图标记(How to add a button to a API v2 Google Maps marker)

我正在研究android谷歌地图应用程序,并且遇到了地图标记问题。

这个问题可能有一个微不足道的解决方案,但搜索后,我只找到如何添加一个标记按钮的链接。 我想要的是不同的:我想要一个标记,其各自的对话框有一个按钮。

有没有人做过类似的事情?

I am working on an android Google Maps app, and am having trouble with map markers.

This question might have a trivial solution but after searching, I have only found links on how to add a marker with a button. What I want is different: I want a marker whose respective dialog box has a button.

Has anyone done anything similar to this?

最满意答案

虽然您可以创建InfoWindowAdapter ,并通过setInfoWindowAdapter()将其附加到GoogleMap ,但要定制信息窗口的内容以包含Button ,该Button将不可点击。 不显示InfoWindowAdapter从getInfoContents()返回的View 。 而是将其转换为Bitmap ,并且该图像就是显示的内容。

但是,您可以通过在GoogleMap上通过setOnInfoWindowClickListener()注册的setOnInfoWindowClickListener()来了解用户何时点击信息窗口。

While you can create an InfoWindowAdapter, and attach it to your GoogleMap via setInfoWindowAdapter(), to tailor the contents of an info window to contain a Button, the Button will not be clickable. The View you return from getInfoContents() in InfoWindowAdapter is not displayed. Rather, it is converted into a Bitmap, and that image is what is displayed.

However, you can find out when the user taps on the info window via an OnInfoWindowClickListener registered via setOnInfoWindowClickListener() on your GoogleMap.

更多推荐

本文发布于:2023-08-04 13:23:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415928.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   标记   按钮   地图   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!