Closed lhtong closed 8 years ago
@CymChad
@lhtong NestedScrollView 嵌套RecyclerView 会导致 RecyclerView的item全部绘制出来。超出屏幕的 item会在 NestedScrollView屏幕外面。在这种嵌套情况下RecyvlerView的高度是无限的,recyclerview 刷新机制是 最下面可见的item+pageSize>totalItem,这样就会一直触发刷新机制。不建议NestedScrollView 或者ScrollView嵌套 可复用View(ListView RecyclerView)
我也遇到了,怎么解决?
Same issue everywhere :)
Reason: As NextedScrollView won't let recycle the items of RecyclerView & loads all the items in one shot, pull-up refresh won't work.
Workaround: We need to manually/listen-to monitor the NestedScrollView's scrolling event & do the load-more-items thing in child's RecyclerView. i.e., as soon the NestedScrollView scrolls to its last, callback the RecyclerView's adapter & load items.
Will post the working solution or 'proof of concept', as soon as I am done with it.
:+1: Cheers !!
@CymChad Amazing lib !! :100:
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll_view" android:layout_width="match_parent" android:layout_height="match_parent"></android.support.v4.widget.NestedScrollView>
RecyclerView做了分页请求处理,当RecyclerView被NestedScrollView包含时,连续自动加载更多,直到分页数据全部加载完成。若是RecyclerView独立使用,加载更多功能正常。主要代码: