如何从 Android ListView 获取第一个可见视图 [英] How to get the first visible View from an Android ListView
本文介绍了如何从 Android ListView 获取第一个可见视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法从Android的ListView中获取第一个可见的View?
Is there a way to get the first visible View out of the ListView in Android?
我可以获取支持 Adapter 中第一个 View 的数据,但似乎无法获取 ListView 中的第一个 View.
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屋!
查看全文