How does Android Paging Library know to load more data?

前端 未结 1 1522
野性不改
野性不改 2020-12-15 22:14

Iʼm fairly new to developing Android apps and Iʼm trying to do everything “the right way.” So right now, Iʼm implementing the new Android Paging Library into my project, whe

相关标签:
1条回答
  • 2020-12-15 22:53

    The paging library should know automatically when to load new items. The problem in your implementation is that the paged RecyclerView is inside a NestedScrollView and according to this issue the libary doesn't have built in support for that.

    when you put recyclerview inside an infinite scrolling parent, it will layout all of its children because the parent provides infinite dimensions.

    You'll need to create your own implementation of Nested Scroll View, there is actually one here in this gist that might be able to help you.

    It is also suggested to add fillViewPort to this custom nested scroll view:

    android:fillViewport="true" to scrollable container

    0 讨论(0)
提交回复
热议问题