Android recyclerview enables pull-down refresh and pull-up loading. More

The official refresh control swiperefreshlayout is used to realize the pull-down refresh. When the recyclerview slides to the bottom, the pull-down loading is realized (the progress bar effect is realized by loading a layout with recyclerview)

You need to complete the drop-down monitoring and pull-up monitoring of the control. The drop-down monitoring is monitored through the setonrefreshlistener() method of swipprefreshlayout, while the pull-up refresh needs to be monitored through the scrolling of the monitoring list. When the list scrolls to the bottom, an event is triggered. The specific code is as follows

Main layout

The following is the effect of rotating the progress bar when pulling up

item_ list_ footer.xml

Adapter

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>