如何禁用RecyclerView滚动使布局侦听其ScrollView父级?

Jah*_*iva 2 android scrollview android-layout android-recyclerview

我想把一个RecyclerView放在里面ScrollView.但是ScrollView不滚动而且RecyclerView确实如此但我不希望它...我该怎么办?

我试过这个类/sf/answers/2115590501/,实际上RecyclerView不再滚动,但也没有ScrollView.

有没有帮助,ScrollView即使与残疾人一起工作RecyclerView?提前致谢.

这是我的布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="jahirfiquitiva.projects.activities.DeveloperActivity">

<include
    android:id="@+id/toolbar"
    layout="@layout/toolbar" />

<ScrollView
    android:id="@+id/osv"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@id/toolbar"
    android:fillViewport="true"
    android:gravity="center"
    android:overScrollMode="never">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:padding="10dp">

        <ImageView
            android:id="@+id/photoJahir"
            android:layout_width="144dp"
            android:layout_height="144dp"
            android:layout_gravity="center"
            android:gravity="center" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:lineSpacingMultiplier="1.2"
            android:paddingBottom="@dimen/lists_padding"
            android:paddingTop="@dimen/lists_padding"
            android:text="@string/developer_bio"
            android:textSize="@dimen/abc_text_size_subtitle_material_toolbar" />

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/dividers_about_section"
            android:alpha="0.3"
            android:background="@color/primary" />

        <RecyclerView
            android:id="@+id/buttonsGrid"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingBottom="@dimen/lists_padding"
            android:paddingTop="@dimen/lists_padding" />

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/dividers_about_section"
            android:alpha="0.3"
            android:background="@color/primary" />

        <View
            android:layout_width="match_parent"
            android:layout_height="72dp" />

    </LinearLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

Kis*_*ath 8

您可以通过将滚动视图更改为NestedScrollView并设置recyclerView.setNestedScrollingEnabled(false) 具有最高性能并且无需覆盖布局管理器来轻松实现它.