Android 滚动视图中的Recycleview

Android 滚动视图中的Recycleview,android,android-layout,android-scrollview,android-recyclerview,Android,Android Layout,Android Scrollview,Android Recyclerview,我创建了一个带有滚动视图的片段,其中包含循环视图。但是回收视图没有显示在视图中。请帮助我如何解决此问题,是否有其他方法可以做到这一点 这是我的layout.xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout

我创建了一个带有滚动视图的片段,其中包含循环视图。但是回收视图没有显示在视图中。请帮助我如何解决此问题,是否有其他方法可以做到这一点

这是我的layout.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingTop="8dp"
        android:paddingLeft="8dp"
        android:paddingRight="8dp"
        android:paddingBottom="8dp"

        android:background="#FFFFFF">
    <ImageView
        android:id="@+id/productdetailpage_productimage"
        android:layout_width="400dp"
        android:layout_height="400dp"

        android:src="@drawable/product_image_menswear"
        android:background="#FFFFFF"/>
        <Button
            android:id="@+id/floatingbutton"
            android:layout_marginTop="390dp"
            android:layout_marginLeft="285dp"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:background="@drawable/shareicon"/>
        <Button
            android:id="@+id/productdetailpage_share"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_marginTop="30dp"
            android:layout_marginLeft="300dp"

            android:background="@drawable/ic_share_grey600_18dp"
            />

        <Button
            android:id="@+id/productdetailpage_likebutton"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_marginTop="30dp"
            android:layout_marginLeft="50dp"

            android:background="@drawable/ic_favorite_outline_red_18dp"
           />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="65dp"
            android:layout_marginLeft="47dp"
            android:text="likes(20)"
            android:textSize="10dp"/>


        <View
            android:id="@+id/productdetailpage_separator2"
            android:layout_width="fill_parent"
            android:layout_height="2px"
            android:layout_below="@+id/productdetailpage_productimage"
            android:layout_marginBottom="2dp"
            android:layout_marginTop="15dp"
            android:background="#90909090"


            />
    <TextView
        android:id="@+id/productdetailpage_productname"
        android:layout_width="230dp"
        android:layout_height="wrap_content"
        android:text="Burton Maroon Casual"
        android:textColor="#000000"
        android:textSize="20dp"
        android:layout_marginTop="4dp"
        android:layout_marginLeft="8dp"

        android:layout_below="@+id/productdetailpage_separator2"
        />
        <TextView
            android:id="@+id/productdetailpage_price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Rs.3000"
            android:textColor="#FB8C00"
            android:textSize="15dp"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="8dp"
            android:layout_below="@+id/productdetailpage_productname"
            />

        <View
            android:id="@+id/productdetailpage_separator3"
            android:layout_width="fill_parent"
            android:layout_height="2px"
            android:layout_below="@+id/productdetailpage_price"
            android:layout_marginBottom="2dp"
            android:layout_marginTop="15dp"
            android:background="#90909090"
            />
        <TextView
            android:id="@+id/productdetailpage_description"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/productdetailpage_separator3"
            android:layout_marginTop="14dp"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:layout_gravity="center_vertical"
            android:text="Look uber trendy and cool wearing this maroon  coloured shirt from the house of Burton. Made of cotton, this printed shirt for men will keep you sweat free and comfortable all day long. This snazzy casual shirt will be a perfect addition to your wardrobe."
            />

        <View
            android:id="@+id/productdetailpage_separator4"
            android:layout_width="fill_parent"
            android:layout_height="2px"
            android:layout_below="@+id/productdetailpage_description"
            android:layout_marginBottom="2dp"
            android:layout_marginTop="15dp"
            android:background="#90909090"
            />


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/availabestore_header"
            android:text="Available in 15 stores"
            android:layout_marginTop="14dp"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginBottom="14dp"
            android:textColor="@color/primaryColor"
            android:layout_below="@+id/productdetailpage_separator4"/>


        <android.support.v7.widget.RecyclerView
            android:paddingTop="8dp"
            android:id="@+id/available_storeslist_productpage"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/availabestore_header"
            ></android.support.v7.widget.RecyclerView>
    </RelativeLayout>
    </ScrollView>

如果您想在
滚动视图中拥有滚动视图,您需要使用:


...

这不是提高性能的最佳方法,但是如果您确实需要它,您应该使用
NestedListView
,正如@ianhanniballake所说。或者尝试中描述的方法

<android.support.v4.widget.NestedScrollView 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

  ...
</android.support.v4.widget.NestedScrollView>