2020-11-28

How to save/restore state of MotionLayout on activity rotation

Steps to reproduce: Run an activity with MotionLayout inside it Transition to a non-initial state Rotate the device or enable/disable dark mode

Observed: The MotionLayout is in it's initial state Expected: The MotionLayout is in the state that was shown before the rotation

Should I put the id of the state inside the savedInstanceState, and then transition to that state (with 0 duration, so it is instantaneous) inside onCreate? This approach I think would work but feels a bit hacky, does anyone know a better solution to this problem?

Here's a recording of the problem: enter image description here



from Recent Questions - Stack Overflow https://ift.tt/36cfPNm
https://ift.tt/3fIQMVx

No comments:

Post a Comment