Android uses the pulltorefresh framework to implement listview pull-down refresh and pull-up loading. More

This example shares more specific codes for Android listview pull-down refresh pull-up load for your reference. The specific contents are as follows

In fact, Google has officially launched the listview drop-down refresh framework swiperefreshlayout. If you want to know, you can click http://blog.csdn.net/zheng_ Jiao / article / details / 51464981; It is not difficult to find that when you use the swiperefreshlayout drop-down, the layout file will not slide down with the gesture, and it seems very difficult to change this defect. Although swiperefreshlayout is very simple and easy to understand, swiperefreshlayout cannot be used when the demand needs to drop-down refresh and slide down with the gesture;

The above picture effect uses the pulltorefresh framework. In my project, the class library and jar package are not imported, but the pull-down refresh function is directly extracted for use; When pulling down, call back and listen. Pull up and load are realized on the basis of extracting the pull-down refresh function. The implementation of more functions is also very simple, so it is written conveniently; I extracted the Android pulltorefresh master framework downloaded from GitHub in the library; First, there are about ten classes to be copied:

Then follow up the error report and copy whatever documents you need; After fixing the error, let's first look at the layout:

It should be noted that by default, the text displayed in the execution animation of pull-down refresh is English. Here, we need to modify pull manually_ refresh_ Contents in strings.xml:

The following is the code for calling pull-down refresh and loading more up and down:

When judging pull-up refresh and pull-down loading, refreshview. Getfooterlayout(). Isshown() refreshview. Getheaderlayout(). Isshown() will report an error, because pulltorrefreshbase is not a common method by default, and we need to manually make it more public

Source download

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