I don't get dividers when I add my custom item. So I opened the example and it seems to me that you get the divider (second CLV) by placing the views not on top (layout).
If you add a simple text item (AddTextItem) it seems that the dividerHeight is used.
Please start a new thread in the questions forum for the divider issue. Make sure to upload a project that demonstrates it (and uses the unmodified CustomListView class).
To demonstate it, I'm attaching a small project (sizes are set for my tablet, in portrait mode, sorry ).
On Activity creation, I add 2 items; then, in the Button1 click event, I remove them and add 2 new items (identical).
Clickng several times you will see that the position of the new second item will be wrong.
P.S. Replaced the CLV with the new and original version 1.76 (same bug).
The issue is fixed for the next update. It happens when you call RemoveAt and remove the last item. Change RemoveAt code to:
B4X:
Public Sub RemoveAt(Index As Int)
If GetSize <= 1 Then
Clear
Return
End If
Dim removePanel, p As Panel
removePanel = panels.Get(Index)
For i = Index + 1 To items.Size - 1
p = panels.Get(i)
p.Tag = i - 1
Dim NewTop As Int = p.Top - heights.Get(Index) - dividerHeight
p.top = NewTop
Next
sv.Panel.Height = sv.Panel.Height - heights.Get(Index) - dividerHeight
items.RemoveAt(Index)
panels.RemoveAt(Index)
heights.RemoveAt(Index)
removePanel.RemoveView
End Sub
Public Sub GetItemFromValue(Value As Object) As Int
Return items.IndexOf(Value)
End Sub
Public Sub GetPanelFromValue(Value As Object) As Panel
Dim pnl As Panel
Dim idx As Int = items.IndexOf(Value)
If idx > - 1 Then
pnl = panels.Get(idx)
End If
Return pnl
End Sub
1. You assume that all values are unique. This may not be the case.
2. CustomListView will not be updated any more. It is replaced with xCustomListView.
Thread is locked. You can start a new thread for any questions you have. Note that it is recommended to switch to xCustomListView.
xCustomListView is more powerful and is cross platform.