在activity的ondcreate中调用 swipeRefreshLayout.setRefreshing(true) 是无法实现的!
实现方法:
swipeRefreshLayout.post(new Runnable() {@Override public void run() { swipeRefreshLayout.setRefreshing(true);
}});取消刷新
swipeRefreshLayout.post(new Runnable() {@Override public void run() { swipeRefreshLayout.setRefreshing(false);
}});实现自动定义的onfresh操作需要在post之前初始化
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { } });