From 7cb24e109089de77c378ce95b5e990ad3d9d15f1 Mon Sep 17 00:00:00 2001 From: teach Date: Thu, 15 Jul 2021 10:54:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConsecutiveScrollerLayout.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/consecutivescroller/src/main/java/com/donkingliang/consecutivescroller/ConsecutiveScrollerLayout.java b/consecutivescroller/src/main/java/com/donkingliang/consecutivescroller/ConsecutiveScrollerLayout.java index 0881fea..e280415 100644 --- a/consecutivescroller/src/main/java/com/donkingliang/consecutivescroller/ConsecutiveScrollerLayout.java +++ b/consecutivescroller/src/main/java/com/donkingliang/consecutivescroller/ConsecutiveScrollerLayout.java @@ -1128,6 +1128,13 @@ private void scrollUp(int offset) { } } + if (mScrollToIndex != -1 && scrollOffset == 0) { + mScrollToIndex = -1; + mSmoothScrollOffset = 0; + mScrollToIndexWithOffset = 0; + setScrollState(SCROLL_STATE_IDLE); + } + } while (scrollOffset > 0 && remainder > 0); int newScrollY = computeVerticalScrollOffset(); @@ -1191,6 +1198,13 @@ private void scrollDown(int offset) { } } + if (mScrollToIndex != -1 && scrollOffset == 0) { + mScrollToIndex = -1; + mSmoothScrollOffset = 0; + mScrollToIndexWithOffset = 0; + setScrollState(SCROLL_STATE_IDLE); + } + } while (scrollOffset < 0 && remainder < 0); int newScrollY = computeVerticalScrollOffset();