我正在开发一个应用程序,我想在其中在 google maps v2 的 InfoWindow 中显示进度条。我已设法使用自定义类 MapInfoWindowAdapter 自定义 InfoWindow。
现在,我想在 Uber map 中使用的 InfoWindow 上显示进度条,以显示进度。
为此,我尝试了两件事
在 info_window_layout 文件中使用进度条
使用加载器的 gif 图像通过一帧一帧地动画显示进度。
它们都产生了静态图像,即根本没有显示任何进展。
最佳答案
出于一个简单的原因,您不能将动画应用到 InfoWindow
。您在 InfoWindow
中看到的不是您定义的布局,而是从中绘制的图像。这意味着您不能操纵此 InfoWindow
。
来自谷歌的文档:
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), callshowInfoWindow()
. 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 - 在 Google Maps api v2 的 MapInfoWindow 中显示进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20987705/