But if update to Version androidx.constraintlayout:constraintlayout:2.1.0
:
The view is going from top-left
How to fix it?
CodePudding user response:
The basic problem is ConstraintLayout gone ends up at 0,0 size 0,0.
There are two possible solutions.
- have a 3rd ConstraintSet. So go from normal to invisible then go to Gone.
- Create KeyFrames of type KeyPosition at framePosition=99 percentX=0, percentY=0
The first fades in the transition to invisible then transitions to Gone. You can AutoTransition to the second gone.
The Second says 0 movement till you hit the last 1% by which time the they are invisible.