Sub Globals
Private CustomListView1 As CustomListView
' Private clvItem As CustomListView
Private xui As XUI
Private nested As CLVNested
Private FlexGrid1 As FlexGrid
Dim EV As Eval
End Sub
Sub Activity_Create(FirstTime As Boolean)
nested.Initialize(Activity)
nested.base.LoadLayout("1")
nested.CLV = CustomListView1
' Dim p As B4XView = xui.CreatePanel("")
' p.SetLayoutAnimated(0, 0, 0, 100%x, 200dip)
' p.LoadLayout("Item")
' p.Tag = FlexGrid1 'must set the Panel tag like this
' CustomListView1.Add(p, "")
' FillInnerList
For i = 1 To 10
CustomListView1.AddTextItem($"*** TITLE (${i}) ***"$, "")
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 100%x, 200dip)
If i Mod 2 = 1 Then
p.LoadLayout("Item")
FillInnerList
Else
p.LoadLayout("ItemHorizontal")
FillHorizontalInnerList
End If
p.Tag = FlexGrid1 'must set the Panel tag like this
CustomListView1.Add(p, "")
Next
End Sub
Sub FillInnerList
EV.Initialize(FlexGrid1)
FlexGrid1.ColsName=Array As String("aa", "bb","cc","X")
FlexGrid1.ColsWidth=Array As Int(25%x,25%x,25%x,25%x)
FlexGrid1.ColsType=Array As Int(FlexGrid1.TypeString,FlexGrid1.TypeString,FlexGrid1.TypeString,FlexGrid1.TypeCheck)
For i= 1 To 10
' clvItem.AddTextItem($"Item #${x}"$, x)
FlexGrid1.AddRow(Array As Object("AA"&i,"BB"&i,"CC"&i,False),True)
Next
End Sub
Sub FillHorizontalInnerList
EV.Initialize(FlexGrid1)
FlexGrid1.ColsName=Array As String("dd", "ee","ff","X")
FlexGrid1.ColsWidth=Array As Int(25%x,25%x,25%x,25%x)
FlexGrid1.ColsType=Array As Int(FlexGrid1.TypeString,FlexGrid1.TypeString,FlexGrid1.TypeString,FlexGrid1.TypeCheck)
For i= 1 To 10
' clvItem.AddTextItem($"Item #${x}"$, x)
FlexGrid1.AddRow(Array As Object("DD"&i,"EE"&i,"FF"&i,False),True)
Next
End Sub