我正在尝试为一个视图设置动画,该视图扩展并缩小回初始大小。我尝试使用动画集添加两个动画,以便第二个动画将在第一个动画之后开始,但无法让它工作。
AnimationSet expandAndShrink = new AnimationSet(true);
ScaleAnimation expand = new ScaleAnimation(
1f, 1.5f,
1f, 1.5f,
Animation.RELATIVE_TO_PARENT, 0,
Animation.RELATIVE_TO_PARENT, 0);
ScaleAnimation shrink = new ScaleAnimation(
1.5f, 1f,
1.5f, 1f,
Animation.RELATIVE_TO_PARENT, 1f,
Animation.RELATIVE_TO_PARENT, 1f);
expandAndShrink.addAnimation(expand);
expandAndShrink.addAnimation(shrink)
expandAndShrink.setFillAfter(true);
expandAndShrink.setDuration(1000);
expandAndShrink.setInterpolator(new AccelerateInterpolator(1.0f));
view.bringToFront();
view.startAnimation(expandAndShrink);
我真的很感激任何帮助让它工作。提前致谢