We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
遇到同样的问题如何解决
Sorry, something went wrong.
在ScrollableHelper的isRecyclerViewTop中添加StaggeredGridLayoutManager的时候的判断即可,项目中没有对这个类型进行判断:
private static boolean isRecyclerViewTop(RecyclerView recyclerView) { if (recyclerView != null) { RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { int firstVisibleItemPosition = ((LinearLayoutManager) layoutManager).findFirstVisibleItemPosition(); View childAt = recyclerView.getChildAt(0); if (childAt == null) { return true; } if (firstVisibleItemPosition == 0) { ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) childAt.getLayoutParams(); int topMargin = lp.topMargin; int top = childAt.getTop(); if (top >= topMargin) { return true; } } }else if (layoutManager instanceof StaggeredGridLayoutManager) { int[] firstVisibleItemPosition = ((StaggeredGridLayoutManager) layoutManager).findFirstVisibleItemPositions(null); int first = firstVisibleItemPosition[0]; //说明适配器里没有数据已经是顶部了 View childAt = recyclerView.getChildAt(0); if (childAt == null) { return true; } //说明可见的是第一个 if (firstVisibleItemPosition.length > 0 && first == 0) { ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) childAt.getLayoutParams(); int topMargin = lp.topMargin; int top = childAt.getTop(); if (top >= topMargin) { return true; } } } } return false; }
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: