Имеется следующий layout
:
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#EEEEEE"
>
<ImageView
android:layout_width="4dp"
android:layout_height="match_parent"
android:background="@color/colorAccent"
/>
<TextView
android:text="12345678911131517192123252729313335373941434547495153555759616365676971737577798183858789"
android:id="@+id/title"
android:textSize="15sp"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
android:layout_marginLeft="8dp"
/>
<TextView
android:text=" text text"
android:id="@+id/prev"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/title"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginLeft="8dp"
/>
<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="WHY WHY WHY"
app:layout_constraintTop_toBottomOf="@+id/prev"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
/>
</android.support.constraint.ConstraintLayout>
Получаем следующий результат:
Причем, если текст первого TextView
изменить, например, на:
"1234567891113151719212325272931333537394143454749515355575961636567697173757779818385878991" (т.е. добавить два символа), то последний TextView перестает наезжать на предпоследний.
Также если у последнего TextView
изменить layout_marginBottom
на 0dp
(а текст оставить как в примере), то проблема также исчезает.
Вопрос: в чем проблема? и как исправить?
UPDATE:
Добавил полоску слева, которая имеет высоту match_parent. Из-за этого нельзя использовать paddingBottom в ConstraintLayout. Элемент используется в RecyclerView, поэтому нижнему элементу нужен margin.