简体   繁体   English

Android ListView 在像素检测中滚动 Position

[英]Android ListView Scroll Position in Pixel Detect

I want to detect the number of pixel on the listview that the user has scrolled.我想检测用户滚动的列表视图上的像素数。 and at the same time, i can base on the number of pixel have been scrolled and i display a textview with the pixel that have been scrolled.同时,我可以根据已滚动的像素数显示 textview 以及已滚动的像素。

would appreciate your answer.thanks!!非常感谢您的回答。谢谢!!

justicepenny正义便士

View.getScrollY should be helpful. View.getScrollY应该会有帮助。 That should give you the scroll position that you're looking for.那应该会给你你正在寻找的卷轴 position。

Check my answer to this question .检查我对这个问题的回答。

View.getScrollY()

is a method inherited from View, and the doc says:是从 View 继承的方法,文档说:

Return the scrolled top position of this view.返回此视图的滚动顶部 position。 This is the top edge of the displayed part of your view.这是视图显示部分的上边缘。

Therefore for full screen lists it will always return 0.因此,对于全屏列表,它将始终返回 0。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM