PullToRefreshListView

代码示范:

<span style="white-space:pre">		</span>myListView.setMode(Mode.BOTH);
		// xia la
		myListView.getLoadingLayoutProxy(true, false).setPullLabel(
				getString(R.string.pull_to_refresh_pull_label));
		myListView.getLoadingLayoutProxy(true, false).setRefreshingLabel(
				getString(R.string.pull_to_refresh_refreshing_label));
		myListView.getLoadingLayoutProxy(true, false).setReleaseLabel(
				getString(R.string.pull_to_refresh_release_label));
		// shang la
		myListView.getLoadingLayoutProxy(false, true).setPullLabel(
				getString(R.string.pull_to_refresh_footer_pull_label));
		myListView.getLoadingLayoutProxy(false, true).setRefreshingLabel(
				getString(R.string.pull_to_refresh_footer_refreshing_label));
		myListView.getLoadingLayoutProxy(false, true).setReleaseLabel(
				getString(R.string.pull_to_refresh_footer_label));
		myListView.setOnRefreshListener(new OnRefreshListener<ListView>() {

			@Override
			public void onRefresh(final PullToRefreshBase<ListView> refreshView) {
				if (refreshView.isHeaderShown()) {
					// 下拉刷新 业务代码
					hasShowDialog = false;
					page = 1;
					hasNext = true;
					enquiry();
				} else {
					// 上拉加载更多 业务代码
					if (hasNext) {
						page++;
						enquiry();
					} else {
						Toast.makeText(
								MainActivity.this,
								getString(R.string.last_page),
								Toast.LENGTH_SHORT).show();
						myListView.onRefreshComplete();
					}
				}
			}
		});
</pre><pre name="code" class="java">
</pre><pre name="code" class="java">刷新完成:调用myListView.onRefreshComplete();




你可能感兴趣的:(PullToRefreshListView)