Android Google map APIv2 InfoWindow 和标记

标签 android progress-bar android-imageview google-maps-android-api-2


我正在使用适用于 Android 的 Google map APIv2。我已经实现了 MapFragment,将标记放在我需要的位置,为标记添加了自定义 InfoWindow。

问题是 - 我的 InfoWindow 中有 AsyncImages ,并且那里有 ProgressBar 。问题是 - ProgressBar 不旋转,并且在我从缓存中获取图像后它也没有设置。 AsyncImages 确实工作得很好。我已经在另一个类(class)测试了它。
我已将我的 AsyncImages View 替换为单个 ProgressBar - 相同。它不旋转。

有什么建议么?

更新。

旋转器不旋转的原因

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.

所以问题是 - 如何以最佳方式从 map 上的网络/缓存实现异步图像?
getContentInfo() 方法之外的某处创建 Views 数组,并创建像 OnImageDownloaded 这样的监听器?

最佳答案

Google Maps Android API v2 Documentation所述:

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.

也许您应该尝试在代码中的某个位置再次调用 showInfoWindow()

关于Android Google map APIv2 InfoWindow 和标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14334390/

相关文章:

javascript - 无法在 Android 设备上运行 React-Native 示例代码

android - 如何从 Activity 中更新 Android fragment ?

c++ - QprogressBar 在一秒内从 0 跳到 100,如何使其平滑

android - android中的垂直进度条

android - 摩托罗拉 Defy 上的 ImageView 是黑色的

android - ui.PictureRecorder() 在 flutter 中给出空白输出?

java - 套接字说它已关闭但实际上没有

android - 使用 HttpClient 和 Progressbar 的异步任务

java - Android RecyclerView item动态布局

android - 是否需要为所有dpi文件夹提供图像?