rive-app / rive-app/rive-android
The size of RiveAnimationView doesn’t change when the animation size increases.
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 538
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
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.
https://github.com/user-attachments/assets/81f6f825-5a07-4059-bd7f-a412efe7cd38
<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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at RiveAnimationView and trace its onMeasure() behavior with the provided XML using wrap_content and riveFit="LAYOUT". Reproduce the expanding animation, then verify that the view resizes smoothly alongside the animation without cropping or a delayed janky requestLayout().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100