Attached are screen shoot and sample project of CustomListView.
From the screen shoot, the first & last item of CustomListView didn't display correctly.
Only after, Activity Resume triggers, CustomListView display all items correctly.
Strangely the text "Info" is lost. Without a real reason... try to add a Sleep(0 [or more, <= 30]) to the bottom of your CreateListItem (before "Return p", of course)
View attachment 96319 Strangely the text "Info" is lost. Without a real reason... try to add a Sleep(0 [or more, <= 30]) to the bottom of your CreateListItem (before "Return p", of course)
Add Sleep solved the problem with this sample, but, when I tried the same method on the real project, Sleep didn't solve the problem.
There is another strange thing on real project, I add this code
B4X:
Sub Delay
LogColor(1,Colors.Yellow)
Sleep(5000000)
End Sub
Sub CreateListItem(Menu As String, Dscp As String,Height As Int) As Panel
Dim p As Panel
p.Initialize("")
p.SetLayout(0, 0, 100%x, Height)
p.LoadLayout("lyMn")
p.Color = Colors.RGB(48,48,48)
LblMn.Text = Menu
LblMn.TextColor = Colors.RGB(250,235,215)
LblMnDscp.Text = Dscp
Delay
Return p
End Sub
Sleep(5000000) didn't delay app as expected, app just ran as if there no delay at all.
Your Sleep(5000000) works like a return (and comes back in 5000 seconds) and your "Delay" will not wait. You need to put the Sleep directly in the function where you want to wait or work with ResumleSub.
Sub CreateListItem(Menu As String, Dscp As String) As Panel
Dim p As Panel
p.Initialize("")
p.LoadLayout("lyMn")
p.SetLayout(0, 0, 100%x, LblMn.Height*1.65)
p.Color = Colors.RGB(48,48,48)
LblMn.Text = Menu
LblMn.TextColor = Colors.RGB(250,235,215)
LblMnDscp.Text = Dscp
Return p
End Sub
Removed parameter height, and calculated panel height based on label height, and it solved the problem.