New issue

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

StickyLayoutHelper如何判断是否已到顶 #277

Closed
xueyaolive opened this Issue Dec 27, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@xueyaolive

xueyaolive commented Dec 27, 2017

No description provided.

@longerian

This comment has been minimized.

Show comment
Hide comment
@longerian

longerian Dec 27, 2017

Contributor

试一下这个方法 public boolean isStickyNow()

Contributor

longerian commented Dec 27, 2017

试一下这个方法 public boolean isStickyNow()

@longerian

This comment has been minimized.

Show comment
Hide comment
@longerian

longerian Dec 27, 2017

Contributor

还有个办法是判断当前屏幕内第一个显示的item的position 是不是大于 StickyLayoutHelper 里负责的那个item位置

Contributor

longerian commented Dec 27, 2017

还有个办法是判断当前屏幕内第一个显示的item的position 是不是大于 StickyLayoutHelper 里负责的那个item位置

@xueyaolive

This comment has been minimized.

Show comment
Hide comment
@xueyaolive

xueyaolive Dec 28, 2017

  • isStickyNow()只能够检测到滑动上去时已经到顶。
  • offsetTotal来自 onBindViewHolderWithOffset(ViewHolder holder, int position, int offsetTotal)
    -但如果virtualLayoutManager.scrollToPositionWithOffset(offsetTotal, 0)手动设置上去的就不行了
    -方法二:是virtualLayoutManager.findFirstVisibleItemPosition()大于offsetTotal时就说明已经到头部了

xueyaolive commented Dec 28, 2017

  • isStickyNow()只能够检测到滑动上去时已经到顶。
  • offsetTotal来自 onBindViewHolderWithOffset(ViewHolder holder, int position, int offsetTotal)
    -但如果virtualLayoutManager.scrollToPositionWithOffset(offsetTotal, 0)手动设置上去的就不行了
    -方法二:是virtualLayoutManager.findFirstVisibleItemPosition()大于offsetTotal时就说明已经到头部了
@longerian

This comment has been minimized.

Show comment
Hide comment
@longerian

longerian Dec 28, 2017

Contributor

嗯 本身就是按照方法二的时机来判断是否要到顶的。

Contributor

longerian commented Dec 28, 2017

嗯 本身就是按照方法二的时机来判断是否要到顶的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment