codelab-constraint-layout
codelab-constraint-layout copied to clipboard
gone margin end not set when using clone() method
I have set app:layout_goneMarginEnd on my view and when I clone the ConstraintSet gone margins are not cloned. I've found my view by its id in the ConstraintSet and all gone margins are set to -1.
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@+id/icon"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintTop_toTopOf="@+id/background"
app:layout_goneMarginEnd="@dimen/gone_margin"/>
Constraint constraintSet = new ConstraintSet();
constraintSet.clone(this);
When I set it manually it works fine
constraintSet.setGoneMargin(title.getId(), ConstraintSet.END, goneMargin);
Update to constratlayoutandroidx.constraintlayout:constraintlayout:2.0.1 fix this issue