本文出自:http://blog.csdn.net/dt235201314/article/details/56844047
一丶概述
最近处于改bug阶段,bug自然就多了
SwipeRefreshLayout和RecyclerView一起使用会造成下拉刷新在上拉之后,轻易下拉就会刷新的bug
二丶解决方法
一个方法便能解决:
public void setSwipeRefreshLayout(SwipeRefreshLayout swipeRefreshLayout) { swipeRefreshLayout.setOnChildScrollUpCallback(new SwipeRefreshLayout.OnChildScrollUpCallback() { @Override public boolean canChildScrollUp(SwipeRefreshLayout parent, @Nullable View child) { if (mRecyclerView == null) { return false; } LinearLayoutManager linearLayoutManager = (LinearLayoutManager) mRecyclerView.getLayoutManager(); return linearLayoutManager.findFirstCompletelyVisibleItemPosition() != 0; } });}
新闻热点
疑难解答