我正在研究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.
更多推荐
发布评论