添加过渡到 AnimationDrawable
我有一组 10 张图像,我想创建一个在它们之间交叉淡入淡出的动画。我一直在研究内置的 Drawable 来实现这样的事情,但在这方面没有运气。 有一个 AnimationDrawable,可以在图片之间切换,但它不会为切换设置动画。 有 TransitionDrawable,它可以在两张图片之间交叉淡入淡出,但不能超过两张。
地狱。
我在谷歌上寻找了一些解决方案,但在那部分没有运气。所以我正在考虑实现我自己的drawable来实现这样的事情。你们中有人能指点一下吗?
提前致谢。
I have a set of 10 images, and I want to create an animation where I cross fade between them. I've been looking into built-in Drawable to achieve such a thing, but no luck on that part.
There is the AnimationDrawable, that switch between pictures, but it doesn't animate the switch.
There is the TransitionDrawable, that cross fade between two pictures, but no more than two.
Hell.
I looked for some solution on Google, but no luck on that part. So I'm thinking about implementing my own drawable to achieve such a thing. Would any of you have any pointers ?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不确定您是否找到了答案,但我遇到了同样的问题,最终基于 TransitionDrawable 构建了自己的类。
用法:
CyclicTransitionDrawable 的代码为 可在 Github 上获取。
Not sure if you found an answer to this, but I had the same problem and ended up building my own class based on TransitionDrawable.
Usage:
The code for the CyclicTransitionDrawable is available on Github.
出色地。很长一段时间过去了,您可能已经解决了问题,但是您得到了 AnimationDrawable 的 setEnterFaceDuration() 。示例:
使用此代码,您可以轻松循环浏览 1..N 个图像,每个图像保持 5 秒(5000 毫秒)并带有淡入动画。 的背景
现在,我要做的是设置我的根relativelayout和AnimationStarterThread类
Well. Long time has passed, and you probably fixed the issue, but you got setEnterFaceDuration() for AnimationDrawable. Example:
With this code you have an easy cycling through 1..N images, each one remains 5s (5000ms) with a fade-in animation. Now, what i do is setting the background of my root RelativeLayout
And the AnimationStarterThread class