public class MainActivity extends AppCompatActivity {
private ImageView img1, img2, img3, img4, img5, img6, img7;
private TextView mTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
img1 = (ImageView) findViewById(R.id.point1);
img2 = (ImageView) findViewById(R.id.point2);
img3 = (ImageView) findViewById(R.id.point3);
mTextView = (TextView) findViewById(R.id.loading);
final ObjectAnimator img1xstart = ObjectAnimator.ofFloat(img1, "scaleX", 1.0f, 1.5f);
final ObjectAnimator img1ystart = ObjectAnimator.ofFloat(img1, "scaleY", 1.0f, 1.5f);
final ObjectAnimator img1xend = ObjectAnimator.ofFloat(img1, "scaleX", 1.5f, 1.0f);
final ObjectAnimator img1yend = ObjectAnimator.ofFloat(img1, "scaleY", 1.5f, 1.0f);
final ObjectAnimator img2xstart = ObjectAnimator.ofFloat(img2, "scaleX", 1.0f, 1.5f);
final ObjectAnimator img2ystart = ObjectAnimator.ofFloat(img2, "scaleY", 1.0f, 1.5f);
final ObjectAnimator img2xend = ObjectAnimator.ofFloat(img2, "scaleX", 1.5f, 1.0f);
final ObjectAnimator img2yend = ObjectAnimator.ofFloat(img2, "scaleY", 1.5f, 1.0f);
final ObjectAnimator img3xstart = ObjectAnimator.ofFloat(img3, "scaleX", 1.0f, 1.5f);
final ObjectAnimator img3ystart = ObjectAnimator.ofFloat(img3, "scaleY", 1.0f, 1.5f);
final ObjectAnimator img3xend = ObjectAnimator.ofFloat(img3, "scaleX", 1.5f, 1.0f);
final ObjectAnimator img3yend = ObjectAnimator.ofFloat(img3, "scaleY", 1.5f, 1.0f);
final AnimatorSet animSet = new AnimatorSet();
final AnimatorSet animSet2 = new AnimatorSet();
final AnimatorSet animSet3 = new AnimatorSet();
final AnimatorSet animSet4 = new AnimatorSet();
animSet.play(img1xstart).with(img1ystart);
animSet.setDuration(500);
mTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
animSet.start();
animSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
animSet2.play(img2xstart).with(img2ystart);
animSet2.play(img1xend).with(img1yend);
animSet2.setDuration(500);
animSet2.start();
}
});
animSet2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
animSet3.play(img3xstart).with(img3ystart);
animSet3.play(img2xend).with(img2yend);
animSet3.setDuration(500);
animSet3.start();
}
});
animSet3.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
animSet.start();
animSet4.play(img3xend).with(img3yend);
animSet4.setDuration(500);
animSet4.start();
System.out.println("end");
}
});
}
});
}
}
这是我写的程序实现三个小圆点一次放大再缩小的动画循环执行 在第一个结束以后执行第二个 第二个结束之后执行第三个
然后第三个小圆点变大之后第一个小圆点再变大 就在第一个小圆点变大之后程序直接崩溃了
报错 java.lang.IllegalStateException: Circular dependencies cannot exist in AnimatorSet
求大神指点一下要怎么修改啊。。