Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private CustomListView1 As CustomListView
End Sub
Public Sub Initialize
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
#if B4A or B4J
Root = Root1
#else if B4i
Root = xui.CreatePanel("")
Root1.Color = xui.Color_White
Root1.AddView(Root, 0, 0, Root1.Width, Root1.Height)
#end if
'load the layout
Root.LoadLayout("frm_main")
If Root.Width = 0 Then
Wait For B4XPage_Resize (Width As Int, Height As Int)
B4XPage_Resize(Width, Height)
End If
For i = 1 To 100
Dim pnl As B4XView = xui.CreatePanel("")
pnl.SetLayoutAnimated(0, 0, 0, CustomListView1.AsView.Width, CustomListView1.AsView.Height)
pnl.Color = Rnd(xui.Color_Black, xui.Color_White)
CustomListView1.Add(pnl, "")
Next
End Sub
Private Sub B4XPage_Resize (Width As Float, Height As Float)
#if B4i
Dim r As Rect = B4XPages.GetNativeParent(Me).SafeAreaInsets
Root.SetLayoutAnimated(0, r.Left, r.Top, Width - r.Right - r.Left, Height - r.Bottom - r.Top)
#end if
End Sub