Sub Globals
Private xui As XUI
Private CustomListView1 As CustomListView
Private switch As B4XSwitch
Private Label1 As Label
Private z, t As Int 't= panel top, z is xClv height
Private w As Int 'color of panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("laymain") 'has CustomListView1
PopulateCLV
End Sub
Sub CreateRandomSizePanels( y As Int) 'y is height of panel
Dim p As Panel
p.Initialize("")
Activity.AddView(p,0, t ,Rnd(100dip, 201dip), y)
Dim px As B4XView =p
w =xui.Color_RGB(Rnd(0,256),Rnd(0,128),Rnd(0,256))
px.SetColorAndBorder(xui.Color_ARGB(0,245,200,128),5dip, w, 5dip)
' p.Color=Colors.ARGB(70,245,200,128)
End Sub
Sub PopulateCLV
For i = 0 To 19
Dim y As Int =Rnd(45dip, 85dip)
If i>0 Then
t=t +y
End If
z=y
CreateRandomSizePanels( y)
Dim s As String = "This is symptom " & (i+1)
CustomListView1.Add(CreateMyItems(s),i)
Next
End Sub
Sub CreateMyItems(s As String) As B4XView 'Problem with this sub
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0,0,0,CustomListView1.AsView.Width,z)
Label1.Text= s
Label1.TextColor =w
Return p
End Sub