Android pull-down refresh library, implemented using viewdraghelper, integrated with pull-down refresh, more loading at the bottom, initial loading of data display loading and other functions
Android pull-down refresh library, implemented by viewdraghelper.
Integrates a drop-down refresh, loads more at the bottom, and loads the data into the loadview. It includes the modification of listview and gridview.
Effect 1:
Effect 2:
Effect 3:
Effect 4:
Effect 5:
Instructions for use:
ImageList = (ListView) findViewById (R. id. image_list); imageAdapter = new ImageAdapter (); imageList. getListView (). setAdapter (imageAdapter); imageList. setLoadDataListener (new PullToRefreshLayout. loadDataListener () {@ Override // pull-down refresh call public void onRefresh () {// simulate loading data in 1 second new Handler (). postDelayed (new Runnable () {@ Override public void run () {loadDate (true) ;}, 1000 );} @ Override // pull down to load more call public void onLoadMore () {// simulate loading data in 1 second new Handler (). postDelayed (new Runnable () {@ Override public void run () {loadDate (false) ;}, 1000 );}}); // simulate loading data in 1 second. new Handler (). postDelayed (new Runnable () {@ Override public void run () {loadDate (true) ;}, 1000 );} /*** simulate loading data ** @ param needFresh whether to refresh and clear the data or continue adding data */public void loadDate (final boolean needFresh) {// refresh, then clear the data if (needFresh) {listData. clear () ;}// add all new data to for (int I = 0; I