簡化Android ListView使用的控件:SuperListview
這個庫讓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);</pre><br />
特性:
-
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 :)
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!