Skip to content

Commit

Permalink
自动滑动的边界判断
Browse files Browse the repository at this point in the history
  • Loading branch information
梁任彦 committed Apr 26, 2020
1 parent 051a6b3 commit 3090565
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,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 @@ -670,8 +670,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 3090565

Please sign in to comment.