javaandroidandroid-recyclerviewheterogeneous

Is there a way to add a button or anything under a RecyclerView


The RecyclerView have to load n number of items initially, when the user scroll to the bottom of it I want a button or any other View on the bottom so that the user can click on it and a method to add n more items is triggered.

I'm new to android app development and I really need help, Thanks.


Solution

  • Android recyclerview is used to display large amount of items on screen, but with improved performance and other benefits. RecyclerView in Android uses an adapter to represent the information we want to show as list. The data to be displayed is sent to adapter, which handles the view.


    Coming to your custom approach of adding a button. You can control the amount of data being sent to adapter at beginning. Considering you have a server that will send data when requested with a tweak to send data in set of row. Add a floating button which is displayed when user reaches end of recyclerview, this button requests further data from server and send a signal to adapter that your variable containing the data has been updated. So, this will add data to your view and you can scroll further until that data ends.

    You can search endless scrolling using RecyclerView to get tutorial related to this.