如何从一个Android ListView的第一个可见视图 [英] How to get the first visible View from an Android ListView

查看:165
本文介绍了如何从一个Android ListView的第一个可见视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方式来获得的第一个可见视图在Android上的ListView?

Is there a way to get the first visible View out of the ListView in Android?

我可以得到备份的适配器的第一个视图中的数据,但似乎我不能在ListView中的第一个视图。

I can get the data that backs the first View in the Adapter but it seems I can't get the first View in ListView.

我要改变第一个可见视图后,滚动操作已结束。我知道我不应该引用保存到视图。

I want to change the first visible view after a scroll action finished. I know that I should not save references to the view.

推荐答案

其实ListView的项目的ListView的只是孩子。所以,第一个可见的ListView项是:

Actually ListView items are just children of ListView. So first visible ListView item is:

listView.getChildAt(0)

这篇关于如何从一个Android ListView的第一个可见视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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