[Kaizige takes you to consolidate the application layer] Is XListView still in use? Try the more beautiful AutoLoadListView !, Xlistview
Reprinted please indicate the source: http://blog.csdn.net/zhaokaiqiang1992
There are already many solutions for pull-up refresh and pull-down loading. XListView and PullToRefresh are well-known open-source projects, which can solve our needs. However, today we use a simpler method to implement the pull-up refresh and pull-down loading functions. I call it AutoLoadListView ~
First.
The refresh effect is implemented using the SwipeRefreshLayout of the v4 compatibility package after version 19. The effect is pretty good. The JumpingBeans of another open-source project is used to automatically load the next page, is it awesome to beat the ellipsis?
The following describes how to use it.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipe_refresh" android:layout_width="match_parent" android:layout_height="match_parent" > <com.socks.autoload.AutoLoadListView android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="match_parent" > </com.socks.autoload.AutoLoadListView> </android.support.v4.widget.SwipeRefreshLayout></RelativeLayout>
- Refresh. We need to implement the SwipeRefreshLayout. OnRefreshListener interface for refreshing, and then implement the refresh logic in onRefresh ().
public void onRefresh()
- Load the next page. We need to add an interface and implement our loading task in the callback.
listView.setOnLoadNextListener(new OnLoadNextListener() { @Override public void onLoadNext() { handler.sendEmptyMessageDelayed(MSG_LOAD_MORE, 3000); } });
Is it easy to use?
Some may ask, what should I do if I want to slide and delete it?
Else...
This is not the only interaction effect! Why can't we hold on to this effect! You can use the [] described earlier to use ActionMode to delete multiple choices of animations !!!
Well, since your product manager is addicted to this effect, let's do it...
- Step 1: Find Our ZListView. If you do not know the truth, please stamp [Android interface implementation] ZListView, the most powerful ListView Control for refreshing, loading, and sliding deletion (1)
- Copy all classes except ZlistView to our project.
- Replace ZListView with AutoLoadListView.
Check it out. OK, too ~ However, because it is a demo, many businesses are not processed. This requires you to modify the source code based on your needs. Isn't the benefits of open-source projects here ~
Github Project address of AutoLoadListView