我想在我的应用程序中显示动画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.
更多推荐
发布评论