Java Android循环显示Recyclerview项目的动画不工作

Java Android循环显示Recyclerview项目的动画不工作,java,android,Java,Android,我想循环显示回收器视图项目的动画。我将下面的代码放在适配器类中,但它不起作用。请帮帮我 public void anim(final CustomViewHolder customViewHolder) { // get the center for the clipping circle int centerX = (customViewHolder.imageView.getLeft() + customViewHolder.imageView.getRight()) / 2

我想循环显示回收器视图项目的动画。我将下面的代码放在适配器类中,但它不起作用。请帮帮我

public void anim(final CustomViewHolder customViewHolder) {
    // get the center for the clipping circle
    int centerX = (customViewHolder.imageView.getLeft() + customViewHolder.imageView.getRight()) / 2;
    int centerY = (customViewHolder.imageView.getTop() + customViewHolder.imageView.getBottom()) / 2;

    int startRadius = 0;
    // get the final radius for the clipping circle
    int endRadius = Math.max(customViewHolder.imageView.getWidth(), customViewHolder.imageView.getHeight());

    // create the animator for this view (the start radius is zero)
    Animator anim =
            null;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        anim = ViewAnimationUtils.createCircularReveal(customViewHolder.rv,
                centerX, centerY, startRadius, endRadius);

        anim.setDuration(1000);
        // make the view invisible when the animation is done
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
            }
        });

        customViewHolder.rv.setVisibility(View.VISIBLE);
        anim.start();
    }
}

当你调用这个函数时?我认为您应该在适配器类中的“onBindViewHolder”函数中调用它。为了让其他人能够帮助您,请描述您期望的确切行为,以及该行为与当前实现中发生的行为有何不同。包括任何错误消息的确切文本(对于任何异常,包括完整文本以及生成错误消息的代码行)。请参阅和。是的,在适配器类的onBindViewHolder中调用,但不起作用!Rayan M tnx,但我的问题很清楚,一个编写的方法不起作用,还需要什么?如果您能提供帮助,请发表意见……我希望在单击项目时运行此动画。@Mohamad Mahdi Rezaei您找到解决方案了吗?当您调用此函数时?我认为您应该在适配器类中的“onBindViewHolder”函数中调用它。为了让其他人能够帮助您,请描述您期望的确切行为,以及该行为与当前实现中发生的行为有何不同。包括任何错误消息的确切文本(对于任何异常,包括完整文本以及生成错误消息的代码行)。请参阅和。是的,在适配器类的onBindViewHolder中调用,但不起作用!Rayan M tnx,但我的问题很清楚,一个编写的方法不起作用,还需要什么?如果您能提供帮助,请发表意见……我希望在单击项目时运行此动画。@Mohamad Mahdi Rezaei您找到解决方案了吗?