Sub CreateListItem(Lay As String, Width As Int, pnl As Panel) As Panel
Dim p1 As B4XView = xui.CreatePanel("")
p1.LoadLayout(Lay)
p1.Height = pnl.Height
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, Width, p1.Height) 'correct height of panel to phone and tablet
p.LoadLayout(Lay)
Return p
End Sub
usage:
clv.Add(CreateListItem("resume", clv.AsView.Width, ResumePanel), 0)
clv.Add(CreateListItem("task", clv.AsView.Width, TaskPanel), 0)