谷歌地图版本2 - 更新信息的窗口 [英] Google Maps Version 2 - Updating information windows
问题描述
我们知道在谷歌地图机器人版本2中,定制的信息的窗口,是转换为图像的图。其实谷歌aftre返回您查看视图转换为图像的再出示给信息窗口。
As we know in google maps android version 2, a custom information windows, is a view that converts to an image. Actually google aftre you return you view converts the view to a image an then show it to the info windows.
但我想说明下载从互联网到我的信息窗口的图像。其实,我想,在此之前下载完整展现一个进度条到我的信息窗口,并在其后compeleted更新信息窗口,通过这个机制我该怎么办呢?
But I want to show images downloading from internet to my infowindow. Actually, I want that before that download complete show an progress bar to my infowindows and after it compeleted update info windows, by this mechanism how I can do this?
推荐答案
- 有一个包含INT进步和位图实际图像模型对象。
- 启动某种开始后台操作(如的AsyncTask )至下载图片。
- 更新模式的进步
- 更新模型从
AsyncTask.onPostExecute
。 图片 - 有模型观察者(见观察partern )。
- 如果您保持
的AsyncTask
(或活动的任何其他类型的
情况下,不要忘了发
的取消
它,你也可以跳过观察者模式。 - 保存参考标记内
InfoWindowAdapter.getInfoWindow
显示信息窗口。说它markerShowingInfoWindow
。 - 当您收到通知进度更新,
从
AsyncTask.onProgressUpdate
。 - Have a model object that contains int for progress and Bitmap for actual image.
- Start some kind of background operation started (e.g. AsyncTask) to download image.
- Update model's progress from
AsyncTask.onProgressUpdate
. - Update model's image from
AsyncTask.onPostExecute
. - Have an observer for model (see Observer partern).
- If you keep
AsyncTask
(or any other kind ofThread
inActivity
context, don't forget tocancel
it and you may also skip observer pattern. - Save reference to marker showing info window inside
InfoWindowAdapter.getInfoWindow
. Call itmarkerShowingInfoWindow
. - When you are notified of progress update,
电话:
if (markerShowingInfoWindow != null && markerShowingInfoWindow.isShowingInfoWindow()) {
markerShowingInfoWindow.showInfoWindow();
}
要强制 InfoWindowAdapter.getInfoWindow
呼叫并创建的ViewGroup
包含进度
和的ImageView
To force InfoWindowAdapter.getInfoWindow
call and create ViewGroup
containing ProgressBar
and ImageView
from progress and image values inside model.
像往常一样,翻译成C#世界这一点。
As always, translate this into C# world.
这篇关于谷歌地图版本2 - 更新信息的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!