实现标记窗口

时间:2013-09-27 14:53:18

标签: android google-maps android-asynctask

我正在使用GoogleMap.InfoWindowAdapter设置标记窗口的内容。

但是内容在服务器上,而我正在使用asynctask来获取它。

这笔交易是当我收到回复时,我的窗口已经创建了。 如果我像这样等待asynctask响应:asynctask.execute(...)。get()应用程序在执行期间冻结。

我想要做的是显示一个带有progressBar的窗口,当我得到服务器的响应时,我删除了progressBar并实现了窗口的内容。

我怎么能这样做?

提前致谢

1 个答案:

答案 0 :(得分:1)

所以请使用onPreExecute启动进度条并在onPostExecute

中取消它

修改

来自文档:

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.

您尝试做的事情不会起作用,因为它被渲染为图像。您可以模拟此操作的唯一方法是不断调用showInfoWindow()进度更新

看一下这个链接

Google Maps Version 2 - Updating information windows