Good day. I am puzzled over how to implement the replace method (View v1, View v2) which should change two View on a fragment of the places that lie in the root of the constrait layout. Thanks in advance for your help.
1 answer
You need to work with the ConstraintSet class.
Found an example of a similar question in English. stack
But this article is better in Russian.
The logic is as follows: Create ConstaintSet set = new ConstraintSet()
You call it .clone(myConstraintLayout) then for specific views you call
set.clear(view1, Constraint.PARAM) clear the reference to the viewpoint and assign it a new counterpart through
set.connect() Then plug in the animation TransitionManager.beginDelayedTransition(myConstraintLayout);
And in the end apply all changes to the layout
set.applyTo(myConstraintLayout); |