【问题标题】:Android marker Infowindow on click点击时的 Android 标记信息窗口
【发布时间】:2013-10-09 15:26:34
【问题描述】:

您好,我对 android google map 上的 infowindow 有疑问。

 @Override
        public View getInfoWindow(Marker arg0) {
            return null;
        }

喜欢这张照片

我想制作一个包含其他菜单的信息窗口。当我点击方向然后谷歌地图将显示,如果我点击另一个文本将显示另一个活动。 我知道那张来自 goole map javascript 的图片

 @Override
        public View getInfoWindow(Marker arg0) {
            return null;
        }

【问题讨论】:

    标签: android marker infowindow


    【解决方案1】:

    这是做不到的。

    来自文档

    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 (for example, 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.

    所以窗口不是一个活动视图,只是一个图像,你能做的最好的就是在点击信息窗口时显示一个对话框

    【讨论】:

    • 信息窗口不是实时视图 - 这是真的,但您确定不能这样做吗?您是否尝试过运行此应用:play.google.com/store/apps/…
    • 我试过了吗,不,我不住在俄罗斯,我不打算让应用程序与我的位置一起工作。谁会说它不是他们创建的自定义视图,但如果它确实像那样工作
    • 这是使用 InfoWindowAdapter 创建的 Google Maps Android API v2 信息窗口。说做不到可能不合适。
    • 您无法使用 Google 在 Android Maps API 中提供的功能来实现。如果您打算插入很多可点击的项目,我建议您只在地图之外显示一个视图。这样一来,您就不会有一个臃肿的 infoWindow 覆盖您的大部分地图。你可以想出类似this 的东西,因为他们已经添加了setPadding() 方法。
    猜你喜欢
    • 2013-10-06
    • 2017-10-30
    • 2016-07-09
    • 1970-01-01
    • 2013-08-14
    • 2013-04-02
    • 1970-01-01
    • 1970-01-01
    • 2013-05-16
    相关资源
    最近更新 更多