Methods of adding headers and footers using recyclerview
The principle of recyclerview and listview is similar: both maintain only a small number of views and can display a large number of data sets. Recyclerview simplifies data display and processing in the following two ways:
Use layoutmanager to determine the arrangement of each item.
Provides default animation effects for adding and deleting items.
Although recyclerview has better performance improvement as a substitute for listview, some common functions of listview are not provided, such as addheaderview and addfooterview, which we often use. Since recyclerview does not provide this method, how should we add headers and bottoms to the list? By looking at the source code of listview, we can know that the header and footer of listview are dynamically added in the adapter, so we also add headerview and footerview to recyclerview according to this idea. Let's see the effect first
If you don't know how to use recyclerview, you can take a look at the previous blog posts
Use of recyclerview HelloWorld
Recyclerview uses many items to load the layout