> PullToRefreshListView
<com.handmark.pulltorefresh.library.PullToRefreshListView
android:id="@+id/pull_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:focusable="true" />
PullToRefreshListView pullList = (PullToRefreshListView) findViewById(R.id.pull_list);
//设置下拉监听
pullList.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
initList();
}
});
ListView lvList = pullList.getRefreshableView();//获取listView对象
pullList.setRefreshing();// 展现下拉刷新控件
pullList.onRefreshComplete();// 表示刷新完成, 收回下拉刷新的控件
<com.handmark.pulltorefresh.library.PullToRefreshListView
android:id="@+id/pull_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:focusable="true" />
PullToRefreshListView pullList = (PullToRefreshListView) findViewById(R.id.pull_list);
//设置下拉监听
pullList.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
initList();
}
});
ListView lvList = pullList.getRefreshableView();//获取listView对象
pullList.setRefreshing();// 展现下拉刷新控件
pullList.onRefreshComplete();// 表示刷新完成, 收回下拉刷新的控件
首次进入自动执行下拉刷新
pullList.setRefreshing();//展现下拉刷新控件(首次进入页面时,自动进行下拉刷新的方法)
首先导入框架到eclipse中,然后在原来的项目中右击properties->android 添加框架到library中
然后改写layout文件