如何根据第一个动画的状态继续第二个动画?
TranslateAnimation translateAnim = new TranslateAnimation(0, desX, 0, desY);
ScaleAnimation scaleAnim = new ScaleAnimation(1, 0.2f, 1, 1Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF, 0.5f);
AnimationSet set = new AnimationSet(false);
set.addAnimation(translateAnim);
set.addAnimation(scaleAnim);
set.setFillAfter(true);
set.setDuration(300);
mView.startAnimation(set);
当动画结束时,我想开始另一个动画,但它会以初始状态返回。
答案 0 :(得分:0)
试试这个:
TranslateAnimation translateAnim = new TranslateAnimation(0, desX, 0, desY);
ScaleAnimation scaleAnim = new ScaleAnimation(1, 0.2f, 1, 1Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF, 0.5f);
AnimationSet set = new AnimationSet(false);
set.addAnimation(translateAnim);
set.addAnimation(scaleAnim);
set.setFillEnabled(true);
set.setFillAfter(true);
set.setDuration(300);
mView.startAnimation(set);
在代码中添加以下行:
set.setFillEnabled(true);
set.setFillAfter(true);