动画褪色背景动态绘制

时间:2015-06-10 11:31:12

标签: android android-animation android-drawable

我有一个可绘制的(线性布局),其动态颜色定义为背景。

我想将当前颜色淡化为高光颜色,然后淡化回最终颜色,这可能与起始颜色不同 突出颜色的过渡应该是0.4s长,从高亮到最终0.2s

我用AnimationDrawable尝试了但没有成功,因为这并不能真正支持淡入淡出。 我目前的代码:

AnimationDrawable animation = new AnimationDrawable();
animation.addFrame(context.getResources().getDrawable(highlightDrawableId), 400);
animation.addFrame(newBackground, 200);

animation.setEnterFadeDuration(200);
animation.setOneShot(true);
layout.setBackground(animation);
animation.start();

我有什么方法可以使这项工作?

0 个答案:

没有答案
相关问题