Mar*_*ler 3 android kotlin lottie
我可以在 Kotlin 中使用 lottie 以编程方式启动动画,但我正在努力创建一个 AnimationListener。我到底该怎么做?
首先,我通过animation_view.progress 使用 if 语句进行了尝试,但这不起作用。
textChanger.setOnClickListener{
animation_view.setAnimation("data.json")
animation_view.playAnimation()
animation_view.loop(false)
}
Run Code Online (Sandbox Code Playgroud)
我希望它能够检测动画何时完成,这样我就可以制作一个吐司。Kotlin 有什么好的lottie 文档吗?
感谢您的帮助,刚刚开始使用 Android 和 Kotlin。
你可以检查一下。
尝试使用此代码:
animation_view.addAnimatorListener(object:Animator.AnimatorListener {
override fun onAnimationRepeat(animation: Animator?) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun onAnimationEnd(animation: Animator?) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun onAnimationCancel(animation: Animator?) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun onAnimationStart(animation: Animator?) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3339 次 |
最近记录: |