Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using an Animated Gif as Ground Overlays in G. Maps v2

I am currently using Google Maps and would like to use an animated Gif as Overlay in my app. This is really frustrating as it seems very easy on iOS version of the app, SO I really want to achieve something cool.

The result I would like to see is on 23s of this video: https://www.youtube.com/watch?v=JI323jA67x0#t=23s

The Ground Overlays seems the bast practice, but doesn't accept animated gif:

LatLng NEWARK = new LatLng(40.714086, -74.228697);

GroundOverlayOptions newarkMap = new GroundOverlayOptions()
        .image(BitmapDescriptorFactory.fromResource(R.drawable.newark_nj_1922))
        .position(NEWARK, 8600f, 6500f);

// Add an overlay to the map, retaining a handle to the GroundOverlay object.
GroundOverlay imageOverlay = map.addGroundOverlay(newarkMap);

https://developers.google.com/maps/documentation/android-api/groundoverlay#add_an_overlay

like image 949
Waza_Be Avatar asked Apr 28 '16 08:04

Waza_Be


People also ask

What is map overlays in android?

Select platform: Android iOS JavaScript. A tile overlay, sometimes called a tile layer, is a collection of images that are displayed on top of the base map tiles.


2 Answers

As a solution, we have decomposed the GIF in multiple images and we are looping all the image list.

We are using the same code as above and everything is fine.

Using an ImageView + Glide as suggested below doesn't help at all as the Image will not move with the Map.

like image 122
Waza_Be Avatar answered Oct 22 '22 11:10

Waza_Be


You can use open source library to display Gif image in a single imageview just add its dependency https://github.com/bumptech/glide

and Its easy to use this an example code

ImageView imageView = (ImageView) findViewById(R.id.imageView);
GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(imageView);
Glide.with(this).load(R.raw.sample_gif).into(imageViewTarget);
like image 29
Adeel Turk Avatar answered Oct 22 '22 11:10

Adeel Turk