Android recyclerview下面的文本视图未显示

Android recyclerview下面的文本视图未显示,android,android-recyclerview,Android,Android Recyclerview,RecyclerView下面的文本视图未显示。整个屏幕被RecyclerView占据。如果我使用Nestedscrollview,则只显示文本视图,而不显示RecyclerView。请提供解决方案 <LinearLayout android:id="@+id/wrapper" android:layout_width="wrap_content" android:layout_height="wrap_content

RecyclerView下面的文本视图未显示。整个屏幕被RecyclerView占据。如果我使用Nestedscrollview,则只显示文本视图,而不显示RecyclerView。请提供解决方案

 <LinearLayout
            android:id="@+id/wrapper"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycler_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scrollbars="vertical" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/wrapper"
            android:orientation="vertical">


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Hello" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Hello" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Hello" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Hello" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Hello" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Hello" />


        </LinearLayout>

    </RelativeLayout>

这将把屏幕分成两部分,前半部分将由recyclerview覆盖,另一部分由TextView覆盖

试试这个

<LinearLayout
    android:id="@+id/wrapper"
    android:orientation="vertical"
    android:layout_weight="1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical" />

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_weight="1"
    android:layout_height="match_parent"
    android:layout_below="@+id/wrapper"
    android:orientation="vertical">


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello" />


</LinearLayout>

如果您希望显示RecycleView和其他视图,如(文本视图,按钮另一个RecycleView…),则可以使用NestedScrollView,如以下示例:

<androidx.core.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"        
        android:layout_marginTop="2dp"
        android:layout_marginStart="2dp"
        android:layout_marginEnd="2dp">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/rv_product"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:text="@string/trending"
            android:supportsRtl="true"
            android:textColor="@color/colorPrimary"
            android:textSize="14sp"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp" />

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/rv_stores"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </LinearLayout>
</androidx.core.widget.NestedScrollView>

我们必须进行布局_height=“0dp”