在 G. Maps v2 中使用动画 Gif 作为地面叠加层 [英] Using an Animated Gif as Ground Overlays in G. Maps v2

查看:20
本文介绍了在 G. Maps v2 中使用动画 Gif 作为地面叠加层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 Google 地图,并希望在我的应用中使用动画 Gif 作为叠加层.这真的很令人沮丧,因为在应用的 iOS 版本上似乎很容易,所以我真的很想实现一些很酷的东西.

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.

我想看到的结果是这个视频的 23 秒:https://www.youtube.com/watch?v=JI323jA67x0#t=23s

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 似乎是最糟糕的做法,但不接受 gif 动画:

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

推荐答案

作为解决方案,我们将 GIF 分解为多张图片,并循环所有图片列表.

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.

按照下面的建议使用 ImageView + Glide 根本没有帮助,因为图像不会随地图移动.

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

这篇关于在 G. Maps v2 中使用动画 Gif 作为地面叠加层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆