How to get Y by percentage height android?

问题描述 投票:0回答:0

你能告诉我如何按高度滚动视图的百分比滚动到位置吗?

此代码知道滚动时的百分比,但如果百分比已知,如何获取 y?

val scrollViewHeight = v.getChildAt(ZERO).bottom - v.height
val getScrollY = v.scrollY
val scrollPosition = getScrollY / scrollViewHeight * 100
Log.i("scrollview", "scroll Percent Y: $scrollPosition")

谢谢:)

android scrollview height percentage android-nestedscrollview
© www.soinside.com 2019 - 2024. All rights reserved.