我正在尝试为我的Horiontal scrollView设置动画。目前,它完美地从左到右:
HorizontalScrollView headband = findViewById(R.id.scroll);
ObjectAnimator.ofInt(headband, "scrollX", 2000).setDuration(10000).start();
现在我想要两件事:
答案 0 :(得分:0)
经过数周的奋斗,终于可以解决了!希望对某人有用。
HorizontalScrollView headband = findViewById(R.id.scroll);
animator1 = ObjectAnimator.ofInt(headband, "scrollX", 1700).setDuration(10000);
animator2 = ObjectAnimator.ofInt(headband, "scrollX", 0).setDuration(10000);
animator1.start();
animator1.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
animator2.start();
}
});
animator2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
animator1.start();
}
});