刷新组件

AURefreshListView 刷新组件是包含下拉刷新及上拉加载的 ListView。

接口说明

/**
 * 下拉刷新的状态监听
 *
 * @param onPullRefreshListener
 */
public void setOnPullRefreshListener(OnPullRefreshListener onPullRefreshListener)

/**
 * 加载更多的状态监听
 *
 * @param onLoadMoreListener
 */
public void setOnLoadMoreListener(OnLoadMoreListener onLoadMoreListener) 

/**
 * 代码开启下拉刷新
 */
public void startRefresh()

/**
 * 下拉刷新结束
 */
public void finishRefresh()

/**
 * 底部加载更多状态更新
 *
 * @param isShowLoad
 * @param hasMore
 */
public void updateLoadMore(boolean isShowLoad, boolean hasMore)

代码示例

<com.alipay.mobile.antui.load.AURefreshListView
    android:id="@+id/refresh_list_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />
listView.setOnPullRefreshListener(new OnPullRefreshListener() {
    @Override
    public void onRefresh() {
        listView.finishRefresh();
        listView.updateLoadMore(true, true);
    }

    @Override
    public void onRefreshFinished() {

    }
});
listView.setOnLoadMoreListener(new OnLoadMoreListener() {
    @Override
    public void onLoadMore() {
        for (int i = 0; i < 3; i++) {
            Map<String, Object> map = new HashMap<String, Object>();
            map.put("PIC", "下接加载更多List");
            map.put("TITLE", "上拉加载更多");
            contents.add(map);
        }
        adapter.notifyDataSetChanged();
        if(contents.size() > 13) {
            listView.updateLoadMore(true, false);
        } else {
            listView.updateLoadMore(true, true);
        }
    }

    @Override
    public void onLoadingFinished() {

    }
});