android 中的无限动画不起作用
Infinite animation in android doesn't work
我尝试向我的应用程序添加无限动画,但它不起作用。这是动画(放大和缩小视图):
<set xmlns:android="http://schemas.android.com/apk/res/android">
<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" />
<scale
android:duration="1000"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="1000"
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:repeatCount="infinite"
但问题是第一个秤一直在执行,而不是在第二个秤之后。
访问This 问题
将 android:repeatCount="infinite"
放入您的体重秤而不是集合中
原本Answered
好的,我结合了所有的答案,最后我这样做了:
<scale
android:repeatCount="infinite"
android:repeatMode="reverse"
android:duration="1000"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="0.5"
android:toYScale="0.5" />
这很好用。只有 android:repeatCount="infinite"
和 android:repeatMode="reverse"
的比例,因此视图可以平滑地放大和缩小
我尝试向我的应用程序添加无限动画,但它不起作用。这是动画(放大和缩小视图):
<set xmlns:android="http://schemas.android.com/apk/res/android">
<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" />
<scale
android:duration="1000"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="1000"
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:repeatCount="infinite"
但问题是第一个秤一直在执行,而不是在第二个秤之后。
访问This 问题
将 android:repeatCount="infinite"
放入您的体重秤而不是集合中
原本Answered
好的,我结合了所有的答案,最后我这样做了:
<scale
android:repeatCount="infinite"
android:repeatMode="reverse"
android:duration="1000"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="0.5"
android:toYScale="0.5" />
这很好用。只有 android:repeatCount="infinite"
和 android:repeatMode="reverse"
的比例,因此视图可以平滑地放大和缩小