0

I've got an ImageView that I rotate with animation by 180 degrees with OnClickListener. If it's triggered very fast (before one animation finishes) the animation bugs out and leaves the View at weird angle (for example rotated 47 degrees versus basic state).

How to prevent next animation before current one finishes or how to deal with it in another way?

bankExpandArrow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (totalText.getVisibility() == View.GONE) {
                    totalText.setVisibility(View.VISIBLE);;
                    bankExpandArrow.animate().rotationBy(180f).start();
                }
                else {
                    totalText.setVisibility(View.GONE);
                    bankExpandArrow.animate().rotationBy(180f).start();
                }
            }
        });

1 Answer 1

1

try using rotation instead of rotationBy

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.