android - NestedScrollView scroll with recyclerview -
i layout recyclerview
in nestedscrollview
, want make nestedscrollview
scroll recyclerview
, happens when recyclerview reach end, below layout code:
<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>
this runtime view:
<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>
and apply .setnestedscrollingenabled
recyclerview
, set false
p.s: api lower 21 :
viewcompat.setnestedscrollingenabled(recyclerview, false);
Comments
Post a Comment