如何将android中的动画链接到同一个视图? [英] How to chain animation in android to the same view?
本文介绍了如何将android中的动画链接到同一个视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些文本视图,我想制作 MSN 的 buzz 效果.
I got some text views and I want to make the buzz effect of MSN.
我的计划是:
- 看一下,比方说向左倾斜 10 度,
- 将其带回起始位置
- 然后将其向上倾斜 10 次
- 然后回来
- 下回
- 左......等等.
我的观点是,我想将一些动作序列设置为一个视图,并且需要一个接一个地执行.
My point is, I have some sequence of movements that I want to set to one view and that needs to execute one after another.
我该怎么做?
推荐答案
使用 动画集:
AnimationSet set = new AnimationSet(true);
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(100);
set.addAnimation(animation);
animation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f
);
animation.setDuration(500);
set.addAnimation(animation);
view.startAnimation( set );
这篇关于如何将android中的动画链接到同一个视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文