添加过渡到AnimationDrawable [英] Add transition to an AnimationDrawable

查看:206
本文介绍了添加过渡到AnimationDrawable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组10张,我想创造一个我过他们之间渐变动画。我一直在寻找到内置的可绘制对象来实现这样的事情,但在这部分没有运气。 还有就是AnimationDrawable,即画面之间切换,但它不动画开关。 还有就是TransitionDrawable,两个图像之间的交叉渐变,但不超过两个。

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.

地狱。

我找了在谷歌上的那部分有些解决方案,但没有运气。所以我想实现我自己的绘制,实现这样的事情。请问你们有任何指针?

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 ?

在此先感谢。

推荐答案

不知道,如果你找到了答案,但我有同样的问题,并最终建立自己的阶级基础TransitionDrawable。

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.

用法:

CyclicTransitionDrawable ctd = new CyclicTransitionDrawable(new Drawable[] { 
  drawable1, 
  drawable2, 
  drawable3, 
  ... 
});

imageView.setImageDrawable(ctd);

ctd.startTransition(1000, 3000) // 1 second transition, 3 second pause between transitions.

在code为CyclicTransitionDrawable是<一个href="https://github.com/plymouthsoftware/android-commons/blob/master/src/com/plymouthsoftware/android/commons/graphics/drawable/CyclicTransitionDrawable.java">available Github上的。

这篇关于添加过渡到AnimationDrawable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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