Search code examples
androidandroid-motionlayout

MotionLayout and constraint Groups


I am going to start using MotionLayout.
After replacing existing ConstraintLayout with the MotionLayout, which has a simple motion scene,
I noticed that androidx.constraintlayout.widget.Group is not working anymore.
Initially, I showed one of the two groups depending on a condition,
but now both of them are visible, even though I set visibility to GONE.
Could I somehow get MotionLayout to work with Groups, or I should use different MotionLayouts?


Solution

  • The most recent version of ConstraintLayout is 2.0.0-beta2 and verified that MotionScene does not care about androidx.constraintlayout.motion.widget.Group. So if you want to change visibility or elevation value you should handle it individually for each View instead of applying to the virtual Group.