github 地址:https://github.com/hgl888/Android-PullToRefresh
工程分为 library,PullToRefreshListFragment, PullToRefreshViewPage和LauncherActivity四部分,library是基础
其中PullToRefreshAdapterViewBase是基类,主要实现onScroll,onScrollStateChange,等操作
PullToRefreshListView继承PullToRefreshAdapterViewBase, 主要实现
setOnRefreshListener
setOnLastItemVisibleListener
等监听,同时还可以根据状态类型,添加声音声音事件,代码如下:/**
* Add Sound Event Listener
*/
SoundPullEventListener<ListView> soundListener = new SoundPullEventListener<ListView>(this);
soundListener.addSoundEvent(State.PULL_TO_REFRESH, R.raw.pull_event);
soundListener.addSoundEvent(State.RESET, R.raw.reset_sound);
soundListener.addSoundEvent(State.REFRESHING, R.raw.refreshing_sound);
mPullRefreshListView.setOnPullEventListener(soundListener);
app 从 LauncherActivity启动,通过ListAdapter添加到界面中