gpt4 book ai didi

android - 如何使标记信息窗口中的内容在android中可点击

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:39:28 24 4
gpt4 key购买 nike

我正在使用自定义布局,在 android 中单击 map 标记时显示为 Infowindow。

enter image description here

在上图中,当我点击 EditText 输入名称时,我确实观察到 Edit Text 没有被编辑,整个窗口被选中。使用自定义布局时,如何使信息窗口中的字段可点击?

请给我任何想法。请帮忙!!

最佳答案

快速回答:你不能。

Google map 将您自定义的 InfoWindow 的内容呈现为图像,并将其作为图像显示给您。因此,您只为整个窗口设置点击监听器,而不是其中的 View 。

您唯一的选择是将 ClickListener 设置为整个 InfoWindow 并弹出一个包含您想要的 EditText View 的对话框,而不是这样做它直接位于 InfoWindow 中。

来自 Google 文档:https://developers.google.com/maps/documentation/android/marker#info_windows

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.

关于android - 如何使标记信息窗口中的内容在android中可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15924045/

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