Hi all
I am trying to modify the CustomListView class for letting me add items to bottom or to the top automatically when i scroll the list.
I get inspiration on Pull-to-refresh (https://www.b4x.com/android/forum/t...mlistview-with-pull-to-refresh-feature.27810/)
and these are my changes:
But if i add items on top (index n. 0) all the following elements shift down.
I tryed to add the following codes to Sub InsertAtImpl
The code is not working as expected and the ListView is not scrolling to the original position
Any suggestions for fixing this behaviour?
Thanks in advance
I am trying to modify the CustomListView class for letting me add items to bottom or to the top automatically when i scroll the list.
I get inspiration on Pull-to-refresh (https://www.b4x.com/android/forum/t...mlistview-with-pull-to-refresh-feature.27810/)
and these are my changes:
B4X:
Private Sub sv_ScrollChanged(Position As Int)
If Position + sv.Height >= sv.Panel.Height Then
If DateTime.Now > lastAddItemsTime + 200 Then
lastAddItemsTime = DateTime.Now
CallSub(CallBack, EventName & "_AddItemsBottom")
End If
End If
If Position = 0 Then
If DateTime.Now > lastAddItemsTime + 200 Then
lastAddItemsTime = DateTime.Now
CallSub(CallBack, EventName & "_AddItemsTop")
End If
End If
End Sub
But if i add items on top (index n. 0) all the following elements shift down.
I tryed to add the following codes to Sub InsertAtImpl
B4X:
Dim Position As Int = sv.ScrollPosition + dividerHeight + ItemHeight
'
'
' Original subroutine code here
'
'
sv.ScrollToNow(Position)
The code is not working as expected and the ListView is not scrolling to the original position
Any suggestions for fixing this behaviour?
Thanks in advance