android中的无限动画不起作用

问题描述 投票:0回答:1

我尝试将无限动画添加到我的应用中,但是它不起作用。我将android:repeatCount="infinite"这样添加到XML文件中:

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:repeatCount="infinite">

<scale
    android:duration="1000"
    android:fromXScale="1.0"
    android:fromYScale="1"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toXScale="0.5"
    android:toYScale="0.5" />

<set android:startOffset="1000">
    <scale

        android:duration="1000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="2"
        android:toYScale="2" />
</set>

或在这样的代码中:

    binding.txtHelp.setOnClickListener {
        val animation = AnimationUtils.loadAnimation(App.context, R.anim.zoomin)
        animation.repeatCount = Animation.INFINITE
        it.startAnimation(animation)
    }

以两种方式执行动画一次

android kotlin android-animation
1个回答
0
投票

访问This 问题

未设置您的秤中的android:repeatCount="infinite"

原为Answered

© www.soinside.com 2019 - 2024. All rights reserved.