Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 919
Leonid Ustenko Avatar asked Jun 27 '19 11:06

Leonid Ustenko


People also ask

What is MotionLayout?

MotionLayout is a layout type that helps you manage motion and widget animation in your app. MotionLayout is a subclass of ConstraintLayout and builds upon its rich layout capabilities. As part of the ConstraintLayout library, MotionLayout is available as a support library and is backwards-compatible to API level 14.

WHAT IS group in constraint layout?

A ConstraintLayout is a ViewGroup that allows you to position and size widgets in a flexible way. ConstraintLayout allows you to create large and complex layouts with a flat view hierarchy (no nested view groups).


1 Answers

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.

like image 189
Darish Avatar answered Nov 02 '22 12:11

Darish