Skip to content

Instantly share code, notes, and snippets.

@dimsuz
Created February 9, 2018 14:18
Show Gist options
  • Save dimsuz/ed4e7fefeacdd3b9749866d01640d37c to your computer and use it in GitHub Desktop.
Save dimsuz/ed4e7fefeacdd3b9749866d01640d37c to your computer and use it in GitHub Desktop.
ConstraintLayout-beta5 bug
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="#f2f2f2"
android:layout_height="wrap_content">
<!-- notice margin top + bottom here -->
<ImageView
android:id="@+id/imageView"
android:layout_marginTop="24dp"
android:layout_marginBottom="24dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:src="@android:color/darker_gray"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:text="TextView1"
app:layout_constraintBottom_toTopOf="@id/textView2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toTopOf="@+id/imageView"
app:layout_constraintVertical_chainStyle="packed"
/>
<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:text="TextView2"
app:layout_constraintBottom_toBottomOf="@+id/imageView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toBottomOf="@+id/textView1" />
</android.support.constraint.ConstraintLayout>
@dimsuz
Copy link
Author

dimsuz commented Feb 9, 2018

This layout rendered with constraint-layout-1.1.0-beta4

cl_bug_beta4

@dimsuz
Copy link
Author

dimsuz commented Feb 9, 2018

This layout rendered with constraint-layout-1.1.0-beta5

cl_bug_beta5

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