如何适应GIF文件在Android的屏幕尺寸 [英] How to fit GIF file to screen size in android

查看:804
本文介绍了如何适应GIF文件在Android的屏幕尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我玩的GIF动画文件中使用的电影类,但在屏幕上可能不适合。

I am playing gif animation file using movie class, but could not fit with in screen.

如何扩展或合适的gif文件,屏幕大小?

How to scale or fit gif file to screen size ?

我已经GIF视图自定义视图,并使用mvoie类播放动画。

I have taken GIF view custom view and playing animation using mvoie class.

推荐答案

您可以用一帧一帧动画,而不是gif动画得到类似的最终结果和缩放。 你需要提取的GIF的每一帧,并把各个帧的PNG(或其他支持的格式)的文件在res /绘制文件夹。创建并使用动画绘制:

You can use a frame by frame animation instead of animated gif to get similar end result and scaling. You need to extract each frame from the gif and place individual frames as png(or other supported format) files in the res/drawable folder. Create and use the animation drawable:

http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html

要缩放动画, <一href="http://stackoverflow.com/questions/6020460/android-how-to-maintain-aspect-ratio-in-animation/20765456#20765456"标题=检查这个>检查这个。

有各种 scaleTypes 你可以用用这个方法来扩展你的动画。

There are various scaleTypes you can use to scale your animation using this method.

我知道这并不直接回答这个问题,但它会得到期望的最终结果。

I know this does not directly answers the question but it will give the desired end result.

这篇关于如何适应GIF文件在Android的屏幕尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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