Я определил ListView внутри ConstraintLayout:
<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:layout_height="match_parent">
<TextView
android:id="@+id/lblTitlePlan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="title"
android:textStyle="normal"
android:textSize="12dp"
android:padding="5dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<RelativeLayout android:id="@+id/layoutTopContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/background_light"
android:elevation="5dp"
android:paddingBottom="10dp"
android:paddingTop="5dp"
app:layout_constraintTop_toBottomOf="@id/lblTitlePlan"
>
...
</RelativeLayout>
<ListView
android:id="@+id/listContainers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:divider="@null"
android:dividerHeight="0dp"
android:paddingTop="80dp"
android:paddingBottom="100dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/layoutTopContainer"/>
</android.support.constraint.ConstraintLayout>
Проблема заключается в том, что, когда в ListView отображается только пара элементов, они центрируются вертикально.Я бы хотел, чтобы они были в верхней части списка.Я думаю, что проблема возникает из ограничений (layout_constraintBottom_toBottomOf и layout_constraintTop_toBottomOf), которые, кажется, также применяются к элементам;потому что, если я удаляю их, элементы находятся вверху (но тогда мой просмотр списка находится в плохом положении).
Как я могу решить это?