You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to get rid of this issue:
in isViewValidAnchor(view, params) you should skip sticky headers when looking for a valid anchor.
private boolean isViewValidAnchor(View view, RecyclerView.LayoutParams params) {
if (isStickyHeader(view)) {
return false; // Skip sticky headers when looking for a valid anchor.
}
// Rest of the existing logic...
}
and then override findLastVisibleItemPosition() and update it with this:
@Override
public int findLastVisibleItemPosition() {
int lastVisiblePosition = RecyclerView.NO_POSITION;
for (int i = getChildCount() - 1; i >= 0; i--) {
View child = getChildAt(i);
int position = getPosition(child);
if (!isStickyHeader(child)) {
lastVisiblePosition = position;
break;
}
}
return lastVisiblePosition;
}
使用
StickyHeadersLinearLayoutManager
后导致lastVisibleItemPosition = ((LinearLayoutManager) layoutManager).findLastCompletelyVisibleItemPosition();
不能正常获取到位置,去掉是好的。The text was updated successfully, but these errors were encountered: