У меня есть приложение, в котором у меня есть RecyclerView и ListView в одном макете. Компоненты работают хорошо индивидуально. RecyclerView и ListViews полностью видимы и прокручиваемы. Однако, когда я помещаю их в один родительский макет как таковой:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:paddingBottom="30dp"
android:background="@color/Cerulean">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.02" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.12" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.05" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.30" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:divider="@color/Cerulean"
android:dividerHeight="5dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline17" />
<ListView
android:id="@+id/listView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:divider="@color/Cerulean"
android:dividerHeight="5dp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/recyclerView" />
<ImageView
android:id="@+id/imageView"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="fitCenter"
android:src="@drawable/logo"
app:layout_constraintBottom_toTopOf="@+id/guideline17"
app:layout_constraintEnd_toStartOf="@+id/guideline14"
app:layout_constraintStart_toStartOf="@+id/guideline13"
app:layout_constraintTop_toTopOf="@+id/guideline15" />
</androidx.constraintlayout.widget.ConstraintLayout>
, у меня просто есть несколько советов, которые помогут мне разместить lo go, и после этого у меня есть свои recyclerView и listViews.
Раньше у меня был только ListView, и я мог прокручивать все. Затем я добавил свой RecyclerView, который также хорошо работал.
Однако, когда RecyclerView надувается и показывает все его содержимое, я больше не могу прокручивать свой ListView. Я вижу все элементы в своем RecyclerView, но как только я прокручиваю свой RecyclerView, я достигаю «дна» своей активности и больше не могу видеть свой ListView.
У меня также есть попытался добавить ScrollView с nestedScrollingEnabled
, установленным в true, но это не помогло. Я мог только просматривать мой RecyclerView и верхнюю строку моего ListView, не говоря уже о том, что процесс прокрутки стал медленным и неубедительным.
Что мне делать, чтобы гарантировать, что я могу прокручивать как свой RecyclerView, так и ListView ?