I have a vector drawable xml file linked to an Image View. Now the animation run only once. How can I continuously animate the result? Someone please help me to make this work. Thanks!
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
animateView(avdImage)
}
}
private fun animateView(view: ImageView) {
when (val drawable = view.drawable) {
is AnimatedVectorDrawableCompat -> {
drawable.start()
}
is AnimatedVectorDrawable -> {
drawable.start()
}
}
}
It might be enough just to add: android:repeatCount = "-1" to your XML file which is handling the rotation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.