Android pull-down refresh official version

There are many articles about pull-down refresh on the Internet, but they are too long. Just found the official pull-down refresh library, and the effect is good, simple and beautiful, and it is also very convenient to use. The following is the rendering:

My friend turned out to be empty, but there were two more after refreshing.

It's very convenient to use. Add swiperefreshlayout to the layout file, which is the layout of drop-down refresh.

I also added a listview in the swiperefreshlayout because I mainly used the drop-down refresh to update the contents of the listview. Layout file:

After the code is written here, as long as you slide down to the top of the main boundary, a drop-down refresh will appear.

Then we need to instantiate the drop-down refresh layout, set what it will do during refresh, and the rotated icon will disappear after refresh.

I wait for one second in the onrefresh function of the listener, then send a message to the handler to update the UI, and then cancel the update after the update.

The above is the whole content of this article. I hope it will be helpful to your study.

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
分享
二维码
< <上一篇
下一篇>>