Skip to content
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

The size of RiveAnimationView doesn’t change when the animation size increases. #356

Open
siddhantsolanki09 opened this issue Feb 17, 2025 · 0 comments

Comments

@siddhantsolanki09
Copy link

I have a rive animation which increases in size when we tap on it.
When I am using that animation in RiveAnimationview with constraints as wrap_content for width and height. The height of the RiveAnimationView is not changing when we tap on the animation as the result the animation gets cropped, I have used riveFit as Layout and have tried multiple things like getting callback from the animation file and updating the layoutsize when animation runs but nothing seems to be working. below is the demo of what is happening and the code of how I have used RiveAnimationView.

Screen.Recording.2025-02-17.at.4.18.36.PM.mov

<app.rive.runtime.kotlin.RiveAnimationView
android:id="@+id/vehicle_rive_item"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:riveFit="LAYOUT"
xmlns:app="http://schemas.android.com/apk/res-auto">

As far as I can understand the below seems to be the issue.

Seems like the issue is that while the animation is running the onMeasure() for the RiveAnimaitonView is not called at all, due to which the layout does not respond to the changes in the animation file, I have even tried to use the RiveFileController.Listener and called the requestLayout() on the notifyStateChanged() callback but in this case first the animation expands completely and than the requestLayout() is called which results in an imporper janky experience, we need to find a way that the layout scales its dimensions along side the animation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant