actionbar-pulltorefresh 的使用

1. 在自己工程app的build.gradle 中加入依赖

   
  dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar']) 
     // compile 'com.android.support:appcompat-v7:22.0.0'
     // compile project(':actionbarsherlock')
     // compile project(':pullToRefreshLibrary') 
    repositories { 
      mavenCentral()
     } 
    compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abs:+'
  }

2. 布局文件中使用

  
    <uk.co.senab.actionbarpulltorefresh.extras.actionbarsherlock.PullToRefreshLayout  
       xmlns:android="http://schemas.android.com/apk/res/android"  
      android:id="@+id/ptr_layout" 
      android:layout_width="match_parent"  
      android:layout_height="match_parent">  
      <!-- Your content, here we're using a ScrollView -->   
    <ScrollView  
        android:layout_width="match_parent"                
        android:layout_height="match_parent">  
    </ScrollView>    
    </uk.co.senab.actionbarpulltorefresh.extras.actionbarsherlock.PullToRefreshLayout>

3. 代码中

    mPullToRefreshLayout = (PullToRefreshLayout) view.findViewById(R.id.ptr_layout); 
    mPullToRefreshLayout.setBackgroundResource(R.color.title_bg); 
    ActionBarPullToRefresh.from(getActivity()) 
    .allChildrenArePullable().listener(this) 
    .setup(mPullToRefreshLayout);

然后实现 OnRefreshListener //接口

@Override 
public void onRefreshStarted(View view) {
  mPullToRefreshLayout.setRefreshComplete();
}

ok!搞定