I have a 2 pane layout. On the left is a ListView, on the rights some content linked with the list. The content is scrollable.
If content moves forward, I want the list to go forward only if this item is not yet displayed. This prevents that the list has to update on every content change. I also want the list to go ahead one full page.
Is there something like
listView.isThisElementCurrentlyShown(int nr)
and
listView.moveAheadOnePage(int direction)
?
Thanks in advance.
Here is an example of
isThisElementCurrentlyShown(Element e):This will tell you whether the element is visible or not.
For the
moveAheadOnePageyou should be able to use listview’s built in functionsgetFirstVisiblePosition()andgetLastVisiblePosition()to calculate the number of rows visible on that device, then advance the listview ahead that many positions. Something like this pseudocode (you will have to write this one):Mind you these are both expensive calls to make while scrolling through a listview, so you will definitely have to implement wisely~
EDIT: Updated code to include
return false