Sub CreateItems
For i = 1 To 1
addRow1(i)
Next
End Sub
Private Sub addRow1(rowIndex As Int)
Dim pnl As B4XView = xui.CreatePanel("")
pnl.SetColorAndBorder(xui.Color_Transparent, 1dip, xui.Color_Black, 5dip)
pnl.SetLayoutAnimated(0, 0, 0, 500dip, 120dip)
pnl.LoadLayout("2") 'has horizontal clv anchored all sides
clvItem.Add(newItem(rowIndex, 2, "Item2"), 0)
clvItem.Add(newItem(rowIndex, 3, "Item3"), 0)
clvItem.Add(newItem(rowIndex, 4, "Item4"), 0)
clvItem.Add(newItem(rowIndex, 5, "Item5"), 0)
clvItem.Add(newItem(rowIndex, 6, "Item6"), 0)
clvItem.Add(newItem(rowIndex, 7, "Item7"), 0)
clvItem.Add(newItem(rowIndex, 8, "Item8"), 0)
CustomListView1.Add(pnl, 1)
End Sub
Private Sub newItem(rowIndex As Int, colIndex As Int, s As String) As B4XView
Dim btn As Button
btn.Initialize("btn")
Dim btnx As B4XView = btn
btnx.SetTextAlignment("CENTER", "CENTER")
btnx.Text = s
btnx.Tag = Array As Int(rowIndex, colIndex)
btnx.Color = Colors.Black
btnx.SetColorAndBorder(xui.Color_black, 1dip, xui.Color_Black, 5dip)
Dim pnl As B4XView = xui.CreatePanel("")
pnl = xui.CreatePanel("")
'pnl.SetColorAndBorder(xui.Color_Transparent, 1dip, xui.Color_Black, 5dip)
pnl.SetLayoutAnimated(0, 0, 0,250dip, 120dip)
pnl.AddView(btnx, 0, 0, 250dip, 120dip)
Return pnl
End Sub