android / codelab-constraint-layout

Constraint Layout Codelab
https://codelabs.developers.google.com/codelabs/constraint-layout/
Apache License 2.0
469 stars 243 forks source link

Strange behavior of Barrier #49

Open ILAgent opened 6 years ago

ILAgent commented 6 years ago

There is a layout markup:

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                         android:layout_width="match_parent"
                                         android:layout_height="wrap_content"
                                         xmlns:app="http://schemas.android.com/apk/res-auto"
                                         android:paddingTop="24dp"
                                         android:paddingBottom="24dp"
>

<ImageView
    android:id="@+id/test_top_image"
    android:background="@color/bean_red"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    />"

<android.support.constraint.Barrier
    android:id="@+id/test_barrier"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:barrierDirection="bottom"
    app:constraint_referenced_ids="test_top_image"
    />

<ImageView
    android:id="@+id/test_bottom_image"
    android:background="@color/blue"
    android:layout_width="match_parent"
    android:layout_marginRight="24dp"
    android:layout_height="16dp"
    app:layout_constraintTop_toBottomOf="@+id/test_barrier"
    />

Three elements: red top_image , the barrier under red top_image and blue bottom_image under the barrier. I'm waiting for this picture:

enter image description here

but I have something other:

enter image description here

Looks like the barrier was moved up at height of blue image. What's wrong ? Thank you !