I have some animations in my Android app and I'd like to change my code in order to take advantage of Android KTX. Sadly, I don't really understand the documentation about it. Could someone tell me how I can improve this code with the help of Android KTX?
view
.animate()
.translationY(view.height.toFloat())
.setDuration(3000)
.setInterpolator(AccelerateInterpolator())
.setListener(object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator?) {}
override fun onAnimationRepeat(animation: Animator?) {}
override fun onAnimationCancel(animation: Animator?) {}
override fun onAnimationEnd(animation: Animator?) {
// Do whatever I want
}
})
Of course, I have already added the dependency in my Gradle file:
implementation 'androidx.core:core-ktx:1.0.2'
Thank you very much in advance :)
from Android animation with KTX
No comments:
Post a Comment