Renaud Favier
Renaud Favier

Reputation: 401

knowing what elements of a list view are currently displayed on screen

I would know if there is a way to know if an element of a list view gets out of the list, (i want to know if the fist element is seen on screen or isn't)

in fact what I want to do with that, is that i want the second element of my list (which is the title of the fragment where the list is) to stay blocked as a header when it goes up (like an letter in the contact app). So what i thought about is to add a hidden clone of the second element above the listview (in the relative layout parent), and set it to visible when the first element goes away of the screen (when the second element is the first element of the seen list).

But maybe is it a native way to do so !

Thanks,

Renaud

Upvotes: 0

Views: 134

Answers (1)

devunwired
devunwired

Reputation: 63293

You can obtain the first and last visible position in the list at any time using the methods getFirstVisiblePosition() and getLastVisiblePosition() on ListView

HTH

Upvotes: 1

Related Questions