小编Pra*_*hil的帖子

在嵌套滚动视图中使用时的分页库加载所有数据

我正在使用分页库来加载数据并填充我放置在nestedscrollview 中的recyclerview。但这就像,分页会自动工作,直到从 API 获取所有数据。我知道这是因为nestedscrollview。但不幸的是,我的布局需要滚动视图,因为我在这个片段中有一个不是 recyclerview 的顶部部分。这是我的布局

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
   >
   <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

   //have a layout here which scrolls with recyclerview

      <Recyclerview />

   </ConstraintLayout>

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

当我不使用nestedscrollview 时,一切正常。googlesamples git repo regsrding 中有一个未解决的问题。

https://github.com/googlesamples/android-architecture-components/issues/215

有谁知道当回收视图位于带有 Android jetpack 分页库的滚动视图中时,我们如何实现分页。我知道我们可以实现传统类型的分页,将侦听器附加到nestedscrollview,但我希望使用架构组件库实现分页。 https://developer.android.com/topic/libraries/architecture/paging/

android android-layout android-architecture-components android-jetpack

9
推荐指数
2
解决办法
2033
查看次数