Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage") 'has vertical clv anchored top and bottom
For i = 1 To 13
addRow(i)
Sleep(20)
Next
End Sub
Private Sub addRow(rowIndex As Int)
Dim pnl As B4XView = xui.CreatePanel("")
pnl.SetColorAndBorder(xui.Color_Transparent, 1dip, xui.Color_Black, 5dip)
pnl.SetLayoutAnimated(0, 0, 0, 600dip, 100dip)
pnl.LoadLayout("hclv") 'has horizontal clv anchored all sides
Sleep(20)
CustomListView2.Add(newItem(rowIndex, 1, "Item1"), 0)
CustomListView2.Add(newItem(rowIndex, 2, "Item2"), 0)
CustomListView2.Add(newItem(rowIndex, 3, "Item3"), 0)
CustomListView2.Add(newItem(rowIndex, 4, "Item4"), 0)
CustomListView2.Add(newItem(rowIndex, 5, "Item5"), 0)
CustomListView2.Add(newItem(rowIndex, 6, "Item6"), 0)
CustomListView2.Add(newItem(rowIndex, 7, "Item7"), 0)
CustomListView2.Add(newItem(rowIndex, 8, "Item8"), 0)
Sleep(20)
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)
Dim pnl As B4XView = xui.CreatePanel("")
pnl = xui.CreatePanel("")
pnl.SetColorAndBorder(xui.Color_Transparent, 1dip, xui.Color_Black, 5dip)
pnl.SetLayoutAnimated(0, 0, 0, 90dip, 100dip)
pnl.AddView(btnx, 0, 0, 90dip, 100dip)
Return pnl
End Sub
Private Sub btn_Click
Dim btnx As B4XView = Sender
Dim ar() As Int = btnx.tag
Log(btnx.Text & TAB & ar(0) & TAB & ar(1))
End Sub
Private Sub CustomListView1_ItemClick (Index As Int, Value As Object) 'Not needed
End Sub
Private Sub CustomListView2_ItemClick (Index As Int, Value As Object) 'Not needed
End Sub