Question

I am working on an app, in which I would like to display progressbar in InfoWindow of google maps v2. I have managed to customize the InfoWindow using a customized class MapInfoWindowAdapter.

Now, I want to show the progressbar on that InfoWindow as such used in the Uber map, to show progress.

For that, I have tried two things

  1. Using progressbar in info_window_layout file

  2. Using gif image for loader to show the progress, by animating its frames one by one.

Both of them resulted in a static image, i.e, showing no progress at all.

Was it helpful?

Solution

You can't apply animation to the InfoWindow, for one simple reason. what you see in the InfoWindow is not the layout you defined but an image that was drawn from it. meaning you can'y manipulate this InfoWindow.

From Google's 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top