我目前正在使用 Google map ,并希望在我的应用中使用动画 Gif 作为叠加层。 这真的很令人沮丧,因为它在 iOS 版本的应用程序上看起来很容易,所以我真的很想实现一些很酷的东西。
我想看到的结果是这个视频的第 23 秒:https://www.youtube.com/watch?v=JI323jA67x0#t=23s
Ground Overlays 似乎是最好的做法,但不接受动画 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 分解为多张图片,并循环所有图片列表。
我们使用与上面相同的代码,一切正常。
按照下面的建议使用 ImageView + Glide 根本没有帮助,因为图像不会随 map 移动。
关于android - 在 G. Maps v2 中使用动画 Gif 作为地面叠加层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36908919/