显示动画GIF [英] Display Animated GIF

查看:138
本文介绍了显示动画GIF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的aplication显示动画GIF图像。 当我发现硬盘的方式Android不支持GIF动画本身。

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

但是它可以使用显示动画<一href="http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html">AnimationDrawable: <一href="http://developer.android.com/guide/topics/graphics/2d-graphics.html#frame-animation">http://developer.android.com/guide/topics/graphics/2d-graphics.html#frame-animation

However it can display animations using AnimationDrawable: http://developer.android.com/guide/topics/graphics/2d-graphics.html#frame-animation

本例使用动画形式保存在应用资源的框架,但我需要的是直接显示gif动画。

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

我的计划是打破GIF动画的帧并作为绘制添加每个帧AnimationDrawable。

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

有谁知道如何提取GIF动画帧,将每个人变成<一href="http://developer.android.com/reference/android/graphics/drawable/Drawable.html">Drawable?

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

推荐答案

安卓其实可以去code和显示GIF动画,使用android.graphics.Movie类。

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

这是不是太多记载,但在 SDK参考。此外,它是用在<一href="https://$c$c.google.com/p/apidemos/source/browse/trunk/ApiDemos/src/com/example/android/apis/graphics/BitmapDe$c$c.java#103">Samples在BitmapDe code 例如一些动画标志。

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.

这篇关于显示动画GIF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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