Private height As Int 'in globals
Dim MyList As List =Array ("map0.png", "map1.png", "map2.png", "map3.png") 'in Activity_Create of B4Xpage_Create
'If GetDeviceLayoutValues.ApproximateScreenSize < 4.5 Then
'height = 310dip
' Else
'height = 280dip
'End If
height = IIf(GetDeviceLayoutValues.ApproximateScreenSize < 4.5, 310dip, 280dip)
For i = 0 To 3
CLV1.Add(CreateItem (CLV1.AsView.Width, $"This is Title #${i}"$, MyList.Get(i), $"This is content #${i}"$) , i)
Next
Private Sub CreateItem(Width As Int, Title As String, Image As String, Content As String) As Panel
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, Width, height)
p.LoadLayout("Card1")
lblTitle.Text = Title
lblContent.Text = Content
ImageView1.SetBitmap(xui.LoadBitmapResize(File.DirAssets, Image, ImageView1.Width, ImageView1.Height, True))
SetColorStateList(lblAction1, xui.Color_LightGray, lblAction1.TextColor)
SetColorStateList(lblAction2, xui.Color_LightGray, lblAction2.TextColor)
Return p
End Sub