There is a RelativeLayout with several views inside. How to make animation of rotation around the Y axis as in the picture?

enter image description here

    1 answer 1

    Use the ObjectAnimator class. Very easy to use

    ObjectAnimator animation = ObjectAnimator.ofFloat(yourView, "rotationY", 0.0f, 360f); animation.setDuration(2400); animation.setRepeatCount(ObjectAnimator.INFINITE); animation.setInterpolator(new AccelerateDecelerateInterpolator()); animation.start(); 
    • The code for some reason does not work, but thanks for the tip. - Alexey
    • @ Alexey is working, replace the second parameter rotationByY with View.ROTATION_Y - ermak0ff
    • No, I just don’t pass on the wrong view)) It works, thank you!) - Alexey
    • one
      @ Alexey, let's not wake people up, the option with rotationByY does not work, you must either write View.ROTATION_Y or rotationY which in principle is equivalent to - ermak0ff