简化Android ListView使用的控件:SuperListview
jopen
11年前
这个库让Android ListView使用方式更加简便。无需将 ListView 嵌入到 FrameLayout或空视图中的方式来增加进度条,该控件已经帮你搞定一切。
list.setRefreshListener(new SwipeRefreshLayout.OnRefreshListener { @Override public void onRefresh() { // Do your refresh }); // when there is only 10 items to see in the list, this is triggered list.setupMoreListener(new OnMoreListener() { @Override public void onMoreAsked(int numberOfItems, int numberBeforeMore, int currentItemPos) { // Fetch more from Api or DB }}, 10); // the 2nd parameters is true if you want SuperListView to automatically // delete the item from the listview or false if you don't list.setupSwipeToDismiss(new SwipeDismissListViewTouchListener.DismissCallbacks() { @Override public boolean canDismiss(int position) { return true } @Override public void onDismiss(ListView listView, int[] reverseSortedPositions) { // Do your stuff like call an Api or update your db }}, true);
特性:
-
ProgressBar while adapter hasn't been set
-
EmptyView if adapter is empty
-
SwipeRefreshLayout (Google's one)
-
Infinite scrolling, when you reach the X last item, load more of them.
-
Swipe To Dismiss for the SuperListView (doesn't make sense for a gridview) (Thanks Roman Nurik)
-
GridView with SuperGridView
-
Open to suggestions (and Pull Request ofc) for others :)