0

经过一段时间的谷歌搜索后,我找不到我需要的东西,我看到一些看起来可以做到的库,但我已经使用 androids 默认方法实现了系统。

我这样设置标记:

theMap.addMarker(new MarkerOptions()
                .position(new LatLng(lat, lon))
                .title(title)
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.pin_map32))
                .snippet(strap));

但是,我需要像 iOS 上的“详细信息披露按钮”(将应用程序从 iOS 转换到 Android),而且我似乎无法向标记添加按钮 - 是否可以使用 androids 系统?

4

3 回答 3

1

总有办法的。

可以在这里找到一个不错的 hack:https ://stackoverflow.com/a/15040761/2183804

我自己还没有测试过,但从那里的评论(以及赞成票的数量)我们可以推断它运作良好。

于 2013-07-03T19:09:41.243 回答
1

这是无法做到的。

文档

Note: The info window that is drawn is not a live view. The view is rendered as an image (using View.draw(Canvas)) at the time it is returned. This means that any subsequent changes to the view will not be reflected by the info window on the map. To update the info window later (e.g., after an image has loaded), call showInfoWindow(). Furthermore, the info window will not respect any of the interactivity typical for a normal view such as touch or gesture events. However you can listen to a generic click event on the whole info window as described in the section below.

换句话说,您不能在信息窗口中放置一个按钮并能够使用它。如果您想做类似的事情,您将需要使用各种对话框

于 2013-07-03T14:31:10.253 回答
0

您只能跟踪标记上的点击。如果您想要标记上的按钮 - 单击标记并显示带有按钮的对话框。

于 2013-07-03T14:46:54.497 回答