分类: Android平台
2015-04-22 15:44:29
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">
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!搞定