如何从一个Android ListView的第一个可见视图第一个、视图、Android、ListView

2023-09-06 02:29:52 作者:看透也是解脱。

有没有一种方式来获得的第一个可见视图在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)