Skip to content

Commit

Permalink
增加自动滑动的边界判断
Browse files Browse the repository at this point in the history
  • Loading branch information
teach committed Apr 26, 2020
1 parent d0489be commit c2bc05d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ private void scrollUp(int offset) {
// 如果是要滑动到指定的View,判断滑动到目标位置,就停止滑动
if (mScrollToIndex != -1) {
View view = getChildAt(mScrollToIndex);
if (getScrollY() + getPaddingTop() >= view.getTop()) {
if (getScrollY() + getPaddingTop() >= view.getTop() || isScrollBottom()) {
mScrollToIndex = -1;
mSmoothScrollOffset = 0;
break;
Expand Down Expand Up @@ -669,8 +669,8 @@ private void scrollDown(int offset) {
// 如果是要滑动到指定的View,判断滑动到目标位置,就停止滑动
if (mScrollToIndex != -1) {
View view = getChildAt(mScrollToIndex);
if (getScrollY() + getPaddingTop() <= view.getTop()
&& ScrollUtils.getScrollTopOffset(view) >= 0) {
if ((getScrollY() + getPaddingTop() <= view.getTop()
&& ScrollUtils.getScrollTopOffset(view) >= 0) || isScrollTop()) {
mScrollToIndex = -1;
mSmoothScrollOffset = 0;
break;
Expand Down

0 comments on commit c2bc05d

Please sign in to comment.