0

I am currently working on an Android application. I have a RecyclerView that I am populating with making calls to a REST API. The API is paginated, so I have managed to load the data progressively. I'm adding data when the user scroll until reaching the bottom of the page. Currently, I have fixed a progressive bar at the bottom of my main layout, below the RecyclerView. (I did this thanks to this post Adding progressbar at the end of recyclerview) This is working but the spinner renders on the text and I would like to avoid that. Is it a way to fit the progressive bar at the bottom of the RecyclerView, as an item and make it disappear when new data are collected ?

Thanks.

vidu.sh
  • 537
  • 1
  • 3
  • 21

1 Answers1

1

Yea, it is possible. Just add and use a new item type and layout for your progress bar.

When you want to start loading items, add this new item type to your item list. This cause that RecyclerView adds this progress bar layout to list as a new item. When loading completed, delete progress bar item and add all new items to list. Then progress bar will be gone and new items will be added.

Side note:

Personally I love RecyclerView for its multiple item type support. It is a great tool, and I love to use this feature for complex RecyclerView structures.

Afshin
  • 8,839
  • 1
  • 18
  • 53