SwipeRefreshLayout 载入时自动刷新

Android 2016-04-13

swipeRefreshLayout = (SwipeRefreshLayout) mView.findViewById(R.id.refresh_layout);
onRefreshListener = new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                loadPage = 0;
                mAdapter.cleanData();
                mAdapter.notifyDataSetChanged();
                Log.v("LishSearch", "开始加载数据");
            }
        };
        swipeRefreshLayout.setOnRefreshListener(onRefreshListener);
//显示加载
        swipeRefreshLayout.post(new Runnable(){
            @Override
            public void run() {
                swipeRefreshLayout.setRefreshing(true);
            }});
        onRefreshListener.onRefresh();

本文由 zhanghuayan 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

赏个馒头吧