Skip to content

Commit

Permalink
快速滑动列表时,偏移量计算异常的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
linzheng committed Dec 1, 2022
1 parent 38325f3 commit b52d203
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,11 @@ class ContentContainerImpl(private val mViewGroup: ViewGroup, private val autoRe
val viewId = contentMeasure.getScrollViewId()
val view = (mViewGroup).findViewById<View>(viewId)
val willScrollDistance = contentMeasure.getScrollDistance(defaultScrollHeight)
val maxDistance = defaultScrollHeight - willScrollDistance
val maxDistance = if (willScrollDistance < defaultScrollHeight) {
defaultScrollHeight - willScrollDistance
} else {
0
}
val parentY = -contentTranslationY

if (parentY < maxDistance) {
Expand All @@ -443,9 +447,6 @@ class ContentContainerImpl(private val mViewGroup: ViewGroup, private val autoRe
view.translationY = maxDistance.toFloat()
}
Log.d("translationContainer", "viewId = $viewId, maxDistance = $maxDistance, parentY = $parentY, y = ${view.translationY}")

// Log.d("translationContainer", "translationContainer: defaultScrollHeight = $defaultScrollHeight , contentTranslationY = $contentTranslationY")
// Log.d("translationContainer", "translationContainer: willScrollDistance = $willScrollDistance , y = ${view.translationY}")
}
}

Expand Down

0 comments on commit b52d203

Please sign in to comment.