In the project often use Xlistview, because it can pull up refresh, pull-down loading interface to do the comparison of humanization, but has not been summed up. Today, the project uses a feature that shows the last refresh time, but not just the last date, but today, yesterday, the day before the show, there are special requirements , such as today, will show 12:13, yesterday will show yesterday 12:13, so the network is not, the re-encapsulation.
Use of Xlistview1 Import
1.1 Get Xlistview,xlistviewfooter and Xlistviewheader and some resource files from the network (network provides package download, Baidu is a bit)
1.2 Put the above three classes as a custom view into your project
1.3 In an XML file, use Xlistview as a custom layout based on the package name Class name
2 Xlistview important ways to explain
setpullloadenable: Whether to hide the bottom "load more" and drop the load more properties, if True indicates that more can be loaded, false to not
Setxlistviewlistener: Setting up listeners
Stoprefresh: Stop refresh, that is, cancel the Headview of the ListView
stoploadmore: Stop loading more, general paging when used, for example, there are two, three pages can not be loaded at a time, to load multiple times, the method used to stop the bottom of the load more display
Used in Class 3
3.1 Implement the Ixlistviewlistener interface in the class to implement, it will prompt you to implement Onrefresh () and Onloadmore () two methods, the two methods is the pull-down call method, by its own call, you just need to according to your needs, Fill in two ways and pull down, pull down what you want it to do
3.2 Findviewbyid Find Xlistview, and then call its setxlistviewlistener to bind the current class (this is the case if your class implements the Xlistviewlistener interface, you can implement it in the class)
3.3 Remember, after the data is loaded to call Stoprefresh or Stoploadmore (depending on your needs), it is easy to cause the program to crash
4 xlistview Function Extension: Determine the time when refreshing, according to the time display today, yesterday, the day before, etc.
The main implementation is to use sharedpreference save the last time (according to 2015.01.02 12:30 this form of saving, easy to calculate), and then each update to do a time comparison, will be compared after the string display, specific implementation of code later I will upload to CSDN, Provide the address again
The use of new things 004--xlistview