2

複数ボタンのフェードアウトアニメーションをスムーズにできますか?

作成された fadeout.xml @res/anim

<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
    android:fromAlpha="1.0"
    android:toAlpha="0.0"
    android:interpolator="@android:anim/accelerate_interpolator" 
    android:duration="1500"
    android:repeatCount="infinite" />
</set>

これを使ってアニメーションを設定する

Animation fadeout = AnimationUtils.loadAnimation(this, R.anim.fadeout);

クリック後にいくつかのボタンにアニメーションを適用します

public void click (View v){
     button1.startAnimation(fadeout);
     button2.startAnimation(fadeout);
     button3.startAnimation(fadeout);
     button4.startAnimation(fadeout);
     button5.startAnimation(fadeout);
     button6.startAnimation(fadeout);
     button7.startAnimation(fadeout);
     button8.startAnimation(fadeout);
     button9.startAnimation(fadeout);
     button10.startAnimation(fadeout);
     button11.startAnimation(fadeout);
     button12.startAnimation(fadeout);
     button13.startAnimation(fadeout);
     button14.startAnimation(fadeout);
     button15.startAnimation(fadeout);
}

3~5個のボタンに適用する場合は問題ありませんが、上記のように多くのボタンに適用するとラグが発生します。

とにかく、このアニメーションをラグなしで多くのボタンに適用する方法はありますか?

このアニメーションを非常に多くのボタン、約 162 個のボタンに適用する必要があるためです。

テストにはGalaxy Nexusを使用しています。

4

1 に答える 1