codelab-constraint-layout icon indicating copy to clipboard operation
codelab-constraint-layout copied to clipboard

Strange behavior of Barrier

Open ILAgent opened this issue 7 years ago • 0 comments

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 !

ILAgent avatar Apr 26 '18 14:04 ILAgent