序列动画无法正常工作

时间:2019-03-30 16:11:04

标签: android android-animation sequence android-imageview

我用animation-list创建了自定义序列动画。这是我的xml代码

<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false"
android:repeatCount="3"
>

<item
    android:drawable="@drawable/arrow_anim_1"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_2"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_3"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_4"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_5"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_6"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_7"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_8"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_9"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_10"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_11"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_12"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_13"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_14"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_15"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_16"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_17"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_18"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_19"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_20"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_21"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_22"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_23"
    android:duration="@integer/animation_debt_loading_time" />
<item
    android:drawable="@drawable/arrow_anim_24"
    android:duration="@integer/animation_debt_loading_time" />

我从这样的Java代码中调用了该动画。

arrow.setBackgroundResource(R.drawable.arrow_animation_list);
animationDrawable animationDrawable = (AnimationDrawable) 
arrow.getBackground();

一切都很好,但是我的目标是在3次重复之后停止动画。如您所见,我正在使用repeatCount,但是不幸的是它没有用。 我试图从代码中检查动画的持续时间,但是我不会从xml文件(带有repeatCount)中检查动画持续时间

0 个答案:

没有答案