Chinaunix首页 | 论坛 | 博客
  • 博客访问: 36746
  • 博文数量: 25
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 258
  • 用 户 组: 普通用户
  • 注册时间: 2014-02-08 15:12
文章分类

全部博文(25)

文章存档

2015年(2)

2014年(23)

我的朋友

分类: Android平台

2015-04-22 15:44:29

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.布局文件中使用
 xmlns:android=""  android:id="@+id/ptr_layout" android:layout_width="match_parent"  android:layout_height="match_parent">      android:layout_width="match_parent"                android:layout_height="match_parent">     

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!搞定
阅读(532) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~