androidx / constraintlayout

ConstraintLayout is an Android layout component which allows you to position and size widgets in a flexible way
Apache License 2.0
1.06k stars 177 forks source link

MotionLayout produces incorrect animation #844

Closed Infernno closed 8 months ago

Infernno commented 8 months ago

I'm trying to make the following screen with MotionLayout:

https://github.com/androidx/constraintlayout/assets/7915327/80b3562d-c1e8-438c-89b0-f3043c28370b

Basically, I have a appbar, cover, user information and content. When the user swipes up, user info goes right under appbar, leaving only content view (green) and app bar.

It looks great and works in portrait mode. Doesn't require any code except XML. However, in landscape mode, it shows a different animation for the content view. It interpolates the size and position of content (green) from the upper left corner instead of being right under user info (red) and overall looks quite weird. The only differences however is that in landscape cover fill parent completely, though it's feels like it shouldn't the problem for MotionLayout to produce correct animation in this case.

https://github.com/androidx/constraintlayout/assets/7915327/17464e84-bd70-4bd3-b994-480a974ff878

I want the animation in landscape mode to be the same as in portrait mode. Is it a bug or am I doing something wrong?

Using androidx.constraintlayout:constraintlayout:2.1.4

Motion Layout and Scene Motion Layout: ``` ``` Motion scene: ``` ```