PullToRefresh是一套实现非常好的下拉刷新库,它支持:
1.ListView
2.ExpandableListView
3.GridView
4.WebView
等多种常用的需要刷新的View类型,而且使用起来也十分方便。
(下载地址:https://github.com/chrisbanes/Android-PullToRefresh)
下载完成,将它导入到eclipse中,作为一个library导入到你的工程中就好了。
一、废话少说,下拉刷新go。
1.在你的布局文件中加上你想用的View就好了,比如这儿我想用一个支持下拉 刷新的ExpandableListView
android:id="@+id/expand_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
2. 在你的Activity代码中进行简单的设置:
mExpandList = (PullToRefreshExpandableListView) rootView.findViewById(R.id.expand_list);
mExpandList.getRefreshableView().setGroupIndicator(null);
mExpandList.getRefreshableView().setDivider(null);
mExpandList.getRefreshableView().setSelector(android.R.color.tra