显示动画GIF(Display Animated GIF)

编程入门 行业动态 更新时间:2024-10-25 20:28:56
显示动画GIF(Display Animated GIF)

我想在我的应用程序中显示动画GIF图像。 当我发现Android不支持动画GIF本来的困难的方式。

但是,它可以使用AnimationDrawable显示动画: http : //developer.android.com/guide/topics/graphics/2d-graphics.html#frame-animation

该示例使用在应用程序资源中保存为帧的动画,但是我需要的是直接显示动画GIF。

我的计划是将动画GIF打破框架,并将每个框架添加到AnimationDrawable中。

有没有人知道如何从动画GIF中提取帧,并将它们转换为Drawable ?

I want to display animated GIF images in my aplication. As I found out the hard way Android doesn't support animated GIF natively.

However it can display animations using AnimationDrawable:

Develop > Guides > Images & Graphics > Drawables Overview

The example uses animation saved as frames in application resources but what I need is to display animated gif directly.

My plan is to break animated GIF to frames and add each frame as drawable to AnimationDrawable.

Does anyone know how to extract frames from animated GIF and convert each of them into Drawable?

最满意答案

Android实际上可以解码和显示动画GIF,使用android.graphics.Movie类。

这不是太多的记录,但是在SDK参考中 。 此外,它在ApiDemos中的Samples中使用BitmapDecode示例中的一些动画标志。

Android actually can decode and display animated GIFs, using android.graphics.Movie class.

This is not too much documented, but is in SDK Reference. Moreover, it is used in Samples in ApiDemos in BitmapDecode example with some animated flag.

更多推荐

本文发布于:2023-08-06 01:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1442011.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:动画   GIF   Animated   Display

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!