Skip to content

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

Description

@ZengHongHua

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();
}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions