-
-
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
LottieDrawable set bounds not working #1079
Comments
I've found a not quite good solution. I override I'm not using the latest version of Lottie. If the latest have support this perfectly, it's ok, if not, maybe LottieDrawable should support something like translate the canvas of animation content. |
@zhangruize Can you attach a sample project? |
I think translating for your specific use case is fine. Most of the time, ImageView scaleType is what you would use to achieve this. |
I'm also trying to setBounds on LottieDrawable, but it's not working. |
I'm facing same issue with |
my workaround, same approach as @zhangruize
|
@Krishna-Vyas @irgaly What version of Lottie? 3.6.0 should respect the bounds you set |
I'm using 3.4.0. I tried Lottie 3.6.1, but the animation appeared at (0, 0). private val drawable = LottieDrawable()
...
// I watched with debugger, they are x = 792, y = 161 here.
drawable.setBounds(x, y, drawable.composition.bounds.right + x, drawable.composition.bounds.bottom + y)
targetView.overlay.add(drawable)
drawable.playAnimation() |
For some special reasons, I need to use LottieDrawable like
View.getOverlay().add(lottieDrawable)
. But I found the animation content cannot be positioned in center though I set correct bounds vialottieDrawable.setBounds(...)
after lottie composition loaded.Is there any way to center LottieDrawable in
View.getOverlay()
?The text was updated successfully, but these errors were encountered: