RecyclerView里面的NestedScrollerView没有滚动内容

时间:2017-12-20 18:43:09

标签: android android-recyclerview android-nestedscrollview

我在android上使用简单的RecyclerView。我使用适配器设置了一些NestedScrollerView子项。两者都具有垂直滚动方向。但是,当我尝试在NestedScrollView中滚动子内容时,它不会滚动,而父滚动器视图正在滚动。 我的父布局如下所示

<?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"
tools:context="com.messenger.nes.myapplication.MainActivity">

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

</android.support.v7.widget.RecyclerView>

子布局是

<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_margin="10dp">
<ImageView
    android:background="@android:color/black"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/img1" /></android.support.v4.widget.NestedScrollView>

我只是创建新的子视图适配器并添加到recyclerview。 但是,当我用列表视图替换recylerview时,滚动在nestedscrollview中运行良好。嵌套滚动在RecyclerView中不起作用吗?

0 个答案:

没有答案