Android xlistview pull-down refresh and pull-up load more

There are many open source frameworks similar to listview refreshing data on the market, such as swiperefreshlayout in V4 package, pulltorefresh integrating listview, GridView and even WebView, etc. The two open source frameworks mentioned above are also used frequently. Interested readers can search by themselves. Of course, they must come back when they have time to summarize and compare all the usage methods. The framework introduced today is specifically for listview to refresh and load by pull-down. If it is only listview, it will be more simple, convenient and easy to understand. 1. First, introduce xlistview_ Lib library to its own demo. 2. Use steps. Its use steps are the same as ordinary listview, which is also the reason for choosing it. It is very simple and convenient to use. The layout is as follows so easy:

Use xlistview as listview:

Operation results:

The above is just a demonstration, and there is no effect of loading and refreshing. Next, load more and refresh in the form of complete code.

In the above code, refresh and load are added, and the system time value during refresh is added while pulling down refresh. Note: the default setting is true for drop-down refresh and false for load more. You need to add the following two lines of code:

Remember to close after refreshing, that is, the following two lines of code are required:

Run to see the effect:

If you want to change its style, it is also very simple. Because its header layout and layout are independent, you can directly modify the display style in the layout file.

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