如何链动画机器人以同样的看法?机器人、看法、动画

2023-09-13 01:57:15 作者:贱婊快滚

我得到了一些文本的意见,我想使MSN的嗡嗡声效果。

I got some text views and I want to make the buzz effect of MSN.

我的计划是:

持有的观点,让说10dip到左侧, 把它回到它的起始位置 在以后把它10dip了 然后返回 下来回 离开...等等。

我的意思是,我有我想设置一种观点认为运动一些序列和需要执行一个接一个。

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 :

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 );