Android 如何在recyclerview中启用GridView的滚动?

Android 如何在recyclerview中启用GridView的滚动?,android,android-recyclerview,android-gridview,Android,Android Recyclerview,Android Gridview,我有一个recycler视图,该recycler视图中的项目如下所示: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" an

我有一个recycler视图,该recycler视图中的项目如下所示:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/question_bkg"
    android:orientation="vertical"
    >
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/questionTitle"
        android:padding="10dp"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:id="@+id/dynamicLayout"
        android:layout_below="@id/questionTitle"
        android:layout_alignParentLeft="true"></LinearLayout>
    <GridView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/dynamicLayout"
        android:numColumns="2"
        android:id="@+id/questionChoicesRecycler"></GridView>
</RelativeLayout>

当我将
recyclerView.setNestedScrollingEnabled设置为true时但我仍然无法在gridview中滚动。我怎样才能解决这个问题?

或者有没有一种方法可以使用recycler而不是gridview,但一行有两个项目?

您可以将RecyclerView与GridLayoutManager类一起使用 更多关于这里


您可以将RecyclerView与GridLayoutManager类一起使用 更多关于这里


将GridView放在ScrollView中

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

    <GridView
        android:layout_width="match_parent"         
        android:layout_height="match_parent"        
        android:layout_below="@id/dynamicLayout"
        android:numColumns="2"        
        android:id="@+id/questionChoicesRecycler">
    </GridView>

</ScrollView>

将GridView放在滚动视图中

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

    <GridView
        android:layout_width="match_parent"         
        android:layout_height="match_parent"        
        android:layout_below="@id/dynamicLayout"
        android:numColumns="2"        
        android:id="@+id/questionChoicesRecycler">
    </GridView>

</ScrollView>


您可以使用ScrollViewInside布局的recyclerView项目??您可以将gridview放置在scrollview中。您可以使用ScrollViewInside布局的recyclerView项目??您可以将gridview放置在scrollview中。我将recycler视图与此布局管理器一起使用,但内部recycler视图的滚动仍被禁用layoutmangaer,但内部回收器视图的滚动仍处于禁用状态