I have layout like this:
<androidx.constraintlayout.widget.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="match_parent">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/colorPrimary"
android:minHeight="300dp"
app:layout_constraintBottom_toTopOf="@+id/recyclerView"
app:layout_constraintHeight_min="300dp"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
FragmentContainerView
and RecyclerView
have dynamic sizes, and FragmentContainerView
should not be less than 300dp
and fit all available spase. RecyclerView
should be on the bottom and can contains from 1 to 20 items. Current solution works ok only for case RecyclerView
contains few items, but for other case it overlaps FragmentContainerView
.
Is it possible to align RecyclerView
to bottom but restrict max size to have free space = 300dp at the top?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…