Sub CreateItem(clr As Int, title As String, size As Int) As B4XView
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, clv1.AsView.Width, ExpandedHeight)
p.LoadLayout("Item")
ListView1.SingleLineLayout.Label.Height = 50dip
ExpandedHeight = (ListView1.SingleLineLayout.Label.Height * (size+1)) + 20dip
listHeight.Add(ExpandedHeight)
ListView1.SingleLineLayout.Label.TextColor = Colors.Blue
p.SetLayoutAnimated(0, 0, 0, p.Width, CollapsedHeight)
pnlExpanded.Height = ExpandedHeight
ListView1.Height = ExpandedHeight
lblTitle.Text = title
pnlTitle.Color = clr
pnlExpanded.Color = ShadeColor(clr)
For i=0 To size - 1
ListView1.AddSingleLine2($"Item ${title}-->${i+1}"$,$"id: ${title}-${i+1}"$)
Next
p.Tag = False 'collapsed
Return p
End Sub