android – NestedScrollView滚动与recyclelerview

我在nestedScrollView中布置RecyclerView,并希望使用RecyclerView进行nestedScrollView滚动,但只有在recyclelerView达到最后才会发生,下面是我的布局代码
<android.support.v4.widget.nestedScrollView
android:id="@+id/lists_frame"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
tools:context="com.example.niuky.design.MainActivity4"
>
    <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:orientation="vertical"
   >
    <View
       android:id="@+id/header"
       android:layout_width="match_parent"
       android:layout_height="256dp"
       android:background="@color/material_blue_grey_800"
       />

   <View
       android:id="@+id/tabs"
       android:layout_width="match_parent"
       android:layout_height="?android:attr/actionBarSize"
       android:background="@color/material_blue_grey_950"
       />

  <android.support.v7.widget.RecyclerView
      android:id="@+id/recyclerview2"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:minHeight="700dp"

      />
   </LinearLayout>
</android.support.v4.widget.nestedScrollView>

这是我的运行时视图:

解决方法

<android.support.v4.widget.nestedScrollView
    android:id="@+id/nested_scrollbar"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="fill_vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:scrollbars="none" >
        <LinearLayout
            android:id="@+id/nested_scrollbar_linear"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

                <android.support.v7.widget.CardView
                    android:id="@+id/flexible.example.cardview"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

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

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/list_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    </LinearLayout>

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

并将.setnestedScrollingEnabled应用于recyclelerview并将其设置为false

P.s:for Api lower 21:

ViewCompat.setnestedScrollingEnabled(recyclelerView,false);

相关文章

Android 通过adb shell命令查看内存,CPU,启动时间,电量等...
Monkey Android app稳定性测试工具之Monkey使用教程 by:授客...
Android 常见adb命令 by:授客 QQ:1033553122 1、 查看所有已...
这篇“android轻量级无侵入式管理数据库自动升级组件怎么实现...
今天小编给大家分享一下Android实现自定义圆形进度条的常用方...
这篇文章主要讲解了“Android如何解决字符对齐问题”,文中的...