あなただけの1つのアニメーションを使用しているので、あなたは<set>
を使用する必要はありません。セットは複数のアニメーションに使用されます。 これを試してみてください:
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="0"
android:toAlpha="1"
android:duration="2000" />
をし、あなたの活動に:
Animation newsAnim= AnimationUtils.loadAnimation(this, R.anim.news_animation);
newsAnim.reset(); // reset initialization state
newsAnim.setRepeatMode(Animation.RESTART);
newsAnim.setRepeatCount(Animation.INFINITE); // Or a number of times
TextView animatedText = (TextView) findViewById(R.id.lbl_animated);
animatedText.startAnimation(newsAnim);
これはあなたのアニメーションを起動する、所望の時間/機能を設定します。 私は、セットでループアニメーションがこれほど簡単ではないことに気付きました。
EDIT:あなたは、あなたが次の操作を行うことができ、明示的に<set>
を使用する必要がある場合:
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0%" android:toXDelta="0%"
android:fromYDelta="100%" android:toYDelta="-100%"
android:duration="15000" android:zAdjustment="bottom"
android:repeatMode="restart"
android:repeatCount="-1" />
<scale
android:fromXScale="4" android:toXScale="1"
android:fromYScale="3" android:toYScale="1"
android:pivotX="50%" android:pivotY="50%"
android:duration="15000"
android:repeatMode="restart"
android:repeatCount="-1" />
</set>
は、すべてのアニメーションの継続時間を注意してください。一貫したアニメーションが必要な場合は、同じままにしてください。
ユアーズ本当に、
Nyllian
感謝。問題は、通常のアクティビティではなくappwidgetをアニメーション化しようとしているため、AnimationUtilsへのアクセス権がないことです。 –