В настоящее время у меня возникли сложности с относительно сложной реализацией проекта на основе ConstraintLayout.
![enter image description here](https://i.stack.imgur.com/QmSC4.png)
Проект представляет собой рядпредметы, как видно выше.Эти строки являются статическими и отображаются / скрываются в зависимости от определенных условий, связанных с данными.
Проблема, с которой я сталкиваюсь, заключается в том, что я не нашел надежного способа правильно разместить каждую строку между разделителями / барьерамиУ меня есть макет.
![enter image description here](https://i.stack.imgur.com/pvVwT.png)
Как вы можете видеть на изображении выше, мой макет ограничений не соответствует ожидаемым барьерам / разделителям.Я включил XML для этого макета ниже.
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<ImageView
android:id="@+id/timeIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_clock"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/timeTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#FF354052"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@id/statusTextView"
app:layout_constraintStart_toEndOf="@+id/textGuideline"
app:layout_constraintTop_toTopOf="parent"
tools:text="4:20 PM" />
<com.weedmaps.driver.android.view.StatusTextView
android:id="@+id/statusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingEnd="27dp"
android:paddingStart="27dp"
android:paddingTop="4dp"
android:textAllCaps="true"
android:textSize="12sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="@color/accepted_blue" />
<android.support.constraint.Barrier
android:id="@+id/headerDividerTopBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="top"
app:constraint_referenced_ids="headerDivider" />
<!-- / end delivery status section -->
<android.support.constraint.Barrier
android:id="@+id/deliveryStatusSectionBottomBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="statusTextView, timeTextView, timeIcon" />
<View
android:id="@+id/headerDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#FFE6EAEE"
app:layout_constraintTop_toBottomOf="@id/deliveryStatusSectionBottomBarrier"
app:layout_constraintBottom_toTopOf="@id/destinationInfoSectionTopBarrier" />
<android.support.constraint.Barrier
android:id="@+id/destinationInfoSectionTopBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="top"
app:constraint_referenced_ids="directionsIcon, addressTextContainer, locationIcon" />
<ImageView
android:id="@+id/locationIcon"
android:layout_width="16dp"
android:layout_height="20dp"
android:src="@drawable/ic_location_pin"
app:layout_constraintTop_toBottomOf="@id/headerDivider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@id/customerInfoSectionTopBarrier" />
<android.support.constraint.Barrier
android:id="@+id/locationIconBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="end"
app:constraint_referenced_ids="locationIcon" />
<LinearLayout
android:id="@+id/addressTextContainer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/headerDivider"
app:layout_constraintEnd_toStartOf="@id/directionsIconBarrier"
app:layout_constraintStart_toEndOf="@+id/textGuideline"
app:layout_constraintBottom_toTopOf="@id/customerInfoSectionTopBarrier">
<TextView
android:id="@+id/addressTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF354052"
android:textSize="14sp"
android:textStyle="bold"
tools:text="423 Clyde Ford Apt. 25" />
<TextView
android:id="@+id/cityStateZipTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF354052"
android:textSize="14sp"
tools:text="Irvine, CA 92602" />
</LinearLayout>
<android.support.constraint.Barrier
android:id="@+id/directionsIconBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:constraint_referenced_ids="directionsIcon" />
<ImageView
android:id="@+id/directionsIcon"
android:layout_width="47dp"
android:layout_height="47dp"
android:src="@drawable/ic_directions"
app:layout_constraintTop_toBottomOf="@id/headerDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/customerInfoSectionTopBarrier" />
<android.support.constraint.Barrier
android:id="@+id/destinationInfoSectionBottomBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="directionsIcon, addressTextContainer, locationIcon" />
<!-- / end destination info section -->
<View
android:id="@+id/destinationDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#FFE6EAEE"
app:layout_constraintTop_toBottomOf="@+id/destinationInfoSectionBottomBarrier" />
<android.support.constraint.Barrier
android:id="@+id/customerInfoSectionTopBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="top"
app:constraint_referenced_ids="customerNotesLayout, smsIcon, phoneIcon, customerInfoLayout, personIcon" />
<ImageView
android:id="@+id/personIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_person"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/customerInfoLayout" />
<LinearLayout
android:id="@+id/customerInfoLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingEnd="8dp"
app:layout_constraintBottom_toTopOf="@id/customerNotesLayout"
app:layout_constraintEnd_toStartOf="@id/phoneIcon"
app:layout_constraintStart_toEndOf="@+id/textGuideline"
app:layout_constraintTop_toBottomOf="@id/destinationDivider">
<TextView
android:id="@+id/nameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="#FF354052"
android:textSize="14sp"
android:textStyle="bold"
tools:text="423 Clyde Ford Apt. 25ssdfsdasvewwevsrdggreve vevevrsv gaervavrvsevsevve0" />
<TextView
android:id="@+id/viewDocumentsTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/delivery_detail_view_documents"
android:textColor="#FF354052"
android:textSize="14sp"
app:layout_constraintStart_toEndOf="@id/personIcon"
app:layout_constraintTop_toBottomOf="@+id/nameTextView" />
</LinearLayout>
<ImageView
android:id="@+id/phoneIcon"
android:layout_width="47dp"
android:layout_height="47dp"
android:layout_marginEnd="8dp"
android:src="@drawable/ic_call"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/customerNotesLayout"
app:layout_constraintEnd_toStartOf="@id/smsIcon"
app:layout_constraintStart_toEndOf="@id/customerInfoLayout"
app:layout_constraintTop_toBottomOf="@id/destinationInfoSectionBottomBarrier"
tools:visibility="visible" />
<ImageView
android:id="@+id/smsIcon"
android:layout_width="47dp"
android:layout_height="47dp"
android:src="@drawable/ic_chat"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/customerNotesLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/phoneIcon"
app:layout_constraintTop_toBottomOf="@id/destinationInfoSectionBottomBarrier"
tools:visibility="visible" />
<android.support.constraint.Barrier
android:id="@+id/customerInfoAndIconBarrierBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="personIcon, customerInfoLayout, phoneIcon, smsIcon" />
<FrameLayout android:id="@+id/customerNotesLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/customerInfoAndIconBarrierBottom"
tools:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/customer_notes_gray"
android:orientation="vertical"
android:layout_marginTop="16dp"
android:paddingStart="32dp"
android:paddingTop="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp">
<TextView
android:id="@+id/customer_note_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="@string/customer_notes_title"
android:textColor="@color/darker_gray"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/customerNote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lineSpacingMultiplier="1.25"
android:textColor="@color/darker_gray"
android:textSize="14sp"
tools:text="iojsdfij siodfjosid fisdfj oidfj osidj fos fghfg hfhfg hgf hfgh fgh fgh fh fgh fghfgh fg fghf gh fgh f gf fgh f fgh gh fg fhfgh fhf hfghfghgfhfghfg hfgfisddjf " />
</LinearLayout>
</FrameLayout>
<android.support.constraint.Barrier
android:id="@+id/customerInfoSectionBottomBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="customerNotesLayout, smsIcon, phoneIcon, customerInfoLayout, personIcon" />
<!-- / end customer info section -->
<View
android:id="@+id/customerDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#FFE6EAEE"
app:layout_constraintTop_toBottomOf="@id/customerInfoSectionBottomBarrier" />
</android.support.constraint.ConstraintLayout>
У меня такое ощущение, что я что-то неправильно использую в макете ограничений, но я не уверен на 100%, что это может быть.
Любое понимание этой проблемы будет с благодарностью.Спасибо!