Проблема с отображением данных при использовании RecyclerView в ScrollView и NestedScrollView? - PullRequest
0 голосов
/ 07 августа 2020

Когда я использую NestedScrollView и ScrollView соответственно и встраиваю в них RecyclerView, я обнаружил, что в ScrollView данные RecyclerView не будут полностью развернуты, тогда как в NestedScrollView данные RecyclerView будут полностью развернуты.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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">

    <ScrollView   <!--androidx.core.widget.NestedScrollView-->
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="10dp"    
        android:layout_marginRight="10dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="300dp"
                android:orientation="horizontal"
                android:layout_marginTop="15dp"
                android:layout_marginLeft="15dp"
                android:layout_marginRight="15dp">

                <TextView
                    android:id="@+id/tvTitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="DetailedDescription"
                    android:textColor="@color/colorBlack"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </RelativeLayout>

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/recyclerView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/design_default_color_primary"/>

        </LinearLayout>
    </ScrollView>   <!--androidx.core.widget.NestedScrollView-->
</LinearLayout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...