そのため、すべて同じ回転仕様を使用して、少数のビューをすべて同時に回転させたいと思います。問題は、何らかの理由で、2番目の要素の回転の動作が異なることです。どうやらこれは、アニメーションオブジェクトがこれらの2行のコード間で実際に状態を変更することに関係しているようです。もちろん、別のアニメーションオブジェクトを作成して適用することもできますが、もっと簡単な方法があるように感じます(約15ビューあります)
最初のビューのみを正しく回転します。
Animation rotateAnim = AnimationUtils.loadAnimation(this, R.anim.rotationtoportrait);
target.startAnimation(rotateAnim);
lightBtn.startAnimation(rotateAnim);
両方を正しく回転させます
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">
誰かアイデアはありますか?