Skip to content
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

使用代码控制滚动,间歇性不生效是什么原因? #35

Open
ZengHongHua opened this issue Jul 6, 2024 · 0 comments
Open

Comments

@ZengHongHua
Copy link

ZengHongHua commented Jul 6, 2024

scrollToClose(), 走完了整个代码, scroller.startScroll(0, getScrollY(), 0, dy, duration); 但是控件就是没有滚动起来。
下面是源码中的,有走完最后一句 invalidate();
使用 setToClosed(), 就没有问题,但是没有滚动效果

public void scrollToClose() {
if (currentInnerStatus == InnerStatus.CLOSED) {
return;
}
if (maxOffset == minOffset) {
return;
}
int dy = -getScrollY() - minOffset;
if (dy == 0) {
return;
}
currentInnerStatus = InnerStatus.SCROLLING;
int duration = MIN_SCROLL_DURATION + Math.abs((MAX_SCROLL_DURATION - MIN_SCROLL_DURATION) * dy / (maxOffset - minOffset));
scroller.startScroll(0, getScrollY(), 0, dy, duration);
invalidate();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant