安卓:ListView.getScrollY() - 它的工作原理? [英] Android: ListView.getScrollY() - does it work?

查看:523
本文介绍了安卓:ListView.getScrollY() - 它的工作原理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用它,但它总是返回0,尽管我已滚动到列表的末尾。

I am using it, but it always returns 0, even though I have scrolled till the end of the list.

推荐答案

getScrollY()实际上是一个方法的视图,而不是ListView控件。它指的是整个视图的滚动量,所以它几乎总是0

getScrollY() is actually a method on View, not ListView. It is referring to the scroll amount of the entire view, so it will almost always be 0.

如果你想知道多远ListView控件的内容滚动,你可以使用listView.getFirstVisiblePosition();

If you want to know how far the ListView's contents are scrolled, you can use listView.getFirstVisiblePosition();

这篇关于安卓:ListView.getScrollY() - 它的工作原理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆