Skip to content

Instantly share code, notes, and snippets.

@akexorcist
Last active April 28, 2021 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akexorcist/cb0268a019e45d4de5fbae30bcfeab97 to your computer and use it in GitHub Desktop.
Save akexorcist/cb0268a019e45d4de5fbae30bcfeab97 to your computer and use it in GitHub Desktop.
Mystery issue in ConstraintLayout 2.0.2
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="16dp"
android:paddingEnd="16dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/child_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toTopOf="@+id/view_divider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<View
android:id="@+id/view_inside"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="#81C784"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/view_item1"
android:layout_width="4dp"
android:layout_height="10dp"
android:layout_marginStart="8dp"
android:background="#E57373"
app:layout_constraintStart_toEndOf="@id/child_layout"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view_item2"
android:layout_width="4dp"
android:layout_height="25dp"
android:layout_marginStart="8dp"
android:background="#64B5F6"
app:layout_constraintBottom_toBottomOf="@+id/child_layout"
app:layout_constraintStart_toStartOf="@id/view_item1"
app:layout_constraintTop_toBottomOf="@+id/view_item1" />
<View
android:id="@+id/view_item3"
android:layout_width="4dp"
android:layout_height="15dp"
android:layout_marginStart="24dp"
android:background="#FFF176"
app:layout_constraintBottom_toBottomOf="@+id/child_layout"
app:layout_constraintStart_toEndOf="@id/child_layout"
app:layout_constraintTop_toTopOf="@+id/child_layout" />
<View
android:id="@+id/view_item_end"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginBottom="16dp"
android:background="#777777"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view_divider"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#777777"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@akexorcist
Copy link
Author

akexorcist commented Apr 28, 2021

Bug condition

view_inside's height : 25dp - 36dp
view_item1's height : 10dp - 16dp
view_item2's height : 25dp
view_item3's height : 0dp - 34dp
view_item_end's height : 14dp
view_divider's height : any dp

@akexorcist
Copy link
Author

akexorcist commented Apr 28, 2021

view_inside : Green
view_item1 : Red
view_item2 : Blue
view_item3 : Yellow
view_item_end : Grey Right End
view_divider : Grey Bottom

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment