我在recyclerView中使用了抽奖动画。这是我的资料来源
if (story.isRead)
lottieAnimationView.setAnimation("story_archive_gray.json");
else
lottieAnimationView.setAnimation("story_archive_blue.json");
final LinearLayout loadMoreContainer = v.findViewById(R.id.load_more_container);
loadMoreContainer.setVisibility(story.isLastElement ? View.VISIBLE : View.GONE);
rootView.setOnClickListener(view -> {
lottieAnimationView.addAnimatorListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
SPLogger.logMassage("animationListener","onAnimationEnd");
animation.cancel();
//call activity
}
@Override
public void onAnimationCancel(Animator animation) {
SPLogger.logMassage("animationListener","onAnimationCancel");
}
@Override
public void onAnimationRepeat(Animator animation) {
SPLogger.logMassage("animationListener","onAnimationRepeat");
}
});
lottieAnimationView.playAnimation();
});
我有一个问题,有时动画无法完成,onAnimationCancel已自动调用。有人可以告诉我原因吗? 我将json文件放在资产文件夹中