Wenden Sie eine Animation gleichzeitig auf mehrere Ansichten an

Ich möchte also eine Handvoll Ansichten gleichzeitig drehen, wobei alle dieselben Rotationsspezifikationen verwenden. Das Problem ist, dass aus irgendeinem Grund die Drehung für das zweite Element anders wirkt. Anscheinend hat dies damit zu tun, dass das Animationsobjekt tatsächlich den Status zwischen diesen beiden Codezeilen ändert. Natürlich könnte ich auch ein separates Animationsobjekt erstellen und anwenden, aber ich habe das Gefühl, dass es einen einfacheren Weg gibt (ich habe ungefähr 15 Ansichten).

Dreht nur die erste Ansicht richtig:

Animation rotateAnim = AnimationUtils.loadAnimation(this, R.anim.rotationtoportrait);
target.startAnimation(rotateAnim);
lightBtn.startAnimation(rotateAnim);

Dreht beide richtig

Animation rotateAnim = AnimationUtils.loadAnimation(this, R.anim.rotationtoportrait);
Animation rotateAnim2 = AnimationUtils.loadAnimation(this, R.anim.rotationtoportrait);
target.startAnimation(rotateAnim);
lightBtn.startAnimation(rotateAnim2);

XML:

<?xml version="1.0" encoding="utf-8"?>
<rotate
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="-90"
    android:toDegrees="0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:duration="500" android:fillAfter="true">

Hat jemand irgendwelche Ideen?

Antworten auf die Frage(2)

Ihre Antwort auf die Frage