设置机器人动画列表编程 [英] set android animation list programmatically

查看:158
本文介绍了设置机器人动画列表编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现加入GIF动画在我的应用程序。

I am trying to achieve adding the animated gifs into my application.

1,我能够从服务器上下载的gif动画。 2 - 我能够得C的gif动画$ C $(用我的自定义去codeR),并有相应的帧单独的位图。

1- I am able to download the animated gif from server. 2- I am able to decode the animated gif (using my custom decoder) and have a separate Bitmap corresponding to its frames.

现在我想用逐帧动画来制作动画。因为我读,执行逐帧动画所需的第一件事就是动漫清单。

Now I want to animate it using the frame by frame animation. As i read, to perform the frame by frame animation the first thing that is required is "animation-list".

我想知道我可以创建所需的动漫清单编程包含每个位图作为一个单独的帧。

I want to know how i can create the required "animation-list" programatically containing each Bitmap as a separate frame.

推荐答案

您可以使用AnimationDrawable类同<一个href="http://androidforums.com/application-development/11620-programmatic-frame-frame-animation-examle-animationdrawable.html">http://androidforums.com/application-development/11620-programmatic-frame-frame-animation-examle-animationdrawable.html但使用而不是从资源采取自己的文件。

You can use AnimationDrawable similiar to http://androidforums.com/application-development/11620-programmatic-frame-frame-animation-examle-animationdrawable.html but use your own files instead of taken from resources.

请注意,你必须要小心的屏幕并下载,而不是从资源考虑,否则它可能看起来不同在不同的屏幕尺寸/分辨率位图的密度。更多关于它在这里:<一href="http://developer.android.com/guide/practices/screens_support.html">http://developer.android.com/guide/practices/screens_support.html特别是看到扩展在运行时创建位图对象一章

Note that you have to be careful about density of screen and bitmaps which are downloaded rather than taken from resources otherwise it might look differently on different screen sizes/resolutions. More about it here: http://developer.android.com/guide/practices/screens_support.html see particularly "Scaling Bitmap Objects created at runtime" chapter

这篇关于设置机器人动画列表编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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