android - 在 Google Maps api v2 的 MapInfoWindow 中显示进度条

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

我正在开发一个应用程序,我想在其中在 google maps v2 的 InfoWindow 中显示进度条。我已设法使用自定义类 MapInfoWindowAdapter 自定义 InfoWindow。

现在,我想在 Uber map 中使用的 InfoWindow 上显示进度条,以显示进度。

为此,我尝试了两件事

  1. 在 info_window_layout 文件中使用进度条

  2. 使用加载器的 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), 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 - 在 Google Maps api v2 的 MapInfoWindow 中显示进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20987705/

相关文章:

android - 来自 Assets 文件夹android的Filenotfound异常?

android - 线程 ID 上的星号是什么意思?

java - 如何使用经度/纬度在数组列表中绘制 map ?

javascript - initMap 不是 Google Maps Javascript 的函数

javascript - 如何从某些百分比更改 Bootstrap 进度条颜色

php - Symfony 控制台 ProgressBar 组件未显示在 Composer 脚本中

java - 如何在 Java、Android 上使用 Intent?

c# - Xamarin iOS Google Maps SDK - mapView.AddObserver() 异常

android - 如何防止 ProgressBar 卡住?

android - FloatingActionButton 不隐藏