问题
How can I find out which items are currently visible
or invisible
in a ListView
?
For example, I have 100 items in ListView
and when i scroll to top of screen or list, I want to detect which items appear or disappear from the viewport.
Illustration:
回答1:
There is no easy way to do this. Here is the same question, however, it does not have an answer.
There is an active GitHub issue about this.
There are multiple solutions for the problem in that issue. This Gist features one that requires the rect_getter package.
Alternatively, you could take a look at this proposal.
TL;DR
This is not yet implemented if you are searching for an easy way to find it out. However, there are solutions, like the ones I mentioned above.
来源:https://stackoverflow.com/questions/57011733/find-out-which-items-in-a-listview-are-visible