-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to use LottieDrawable: animation doesn't start #37
Milestone
Comments
If you can attach a sample file, I'll investigate. |
Here is a small project demonstrating the problem: |
Thanks for the report. I have a fix up #49 and will release 1.0.1 soon. |
👍 |
@BoD Can you try again with Lottie 1.0.1? I just released it so it may take a few hours to propagate through maven. |
I just tried, and I confirm it now works :) |
class LottieView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {
private var mLottieDrawable: LottieDrawable = LottieDrawable()
init {
mLottieDrawable.setImagesAssetsFolder("lottie/vip/images")
mLottieDrawable.repeatCount = LottieDrawable.INFINITE
mLottieDrawable.callback = this
mLottieDrawable.repeatMode = LottieDrawable.RESTART
LottieCompositionFactory.fromAsset(context.applicationContext, "lottie/vip/vip.json").addListener { result ->
mLottieDrawable.composition = result
mLottieDrawable.setBounds(0, 0, 100, 100)
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
mLottieDrawable.start()
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
mLottieDrawable.stop()
}
override fun verifyDrawable(who: Drawable): Boolean {
return who == mLottieDrawable || super.verifyDrawable(who)
}
override fun onDraw(canvas: Canvas) {
mLottieDrawable.draw(canvas)
}
} |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
I just tried Lottie and I could make
LottieAnimationView
work with no problems.However, I cannot make
LottieDrawable
work, and I wonder what I am doing wrong.Here is what I do:
The result is I only see the first frame - the animation doesn't start.
I looked at the source of
LottieAnimationView
to compare, and didn't see any major difference.Any idea?
The text was updated successfully, but these errors were encountered: