Android Question [SOLVED] Add individual text to Cards (CustomListView)

GMan

Well-Known Member
Licensed User
Longtime User
i am using Erels example of the "Cards"
https://www.b4x.com/android/forum/threads/cards-list-with-customlistview.87720/

Here is the CreateItem section:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("1")
    Activity.AddMenuItem3("", "refresh", xui.LoadBitmapResize(File.DirAssets, "ic_cached_white_24dp.png", 32dip, 32dip, True), True)
    Activity.AddMenuItem3("", "done", xui.LoadBitmapResize(File.DirAssets, "ic_done_white_24dp.png", 32dip, 32dip, True), True)
    Dim bitmaps As List = Array("1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg")
    For i = 1 To 6
        Dim content As String = $"Repeating text"$
        CLV1.Add(CreateItem(CLV1.AsView.Width, $"FP-19-${i}"$, bitmaps.Get(i - 1), content), "")
    Next
End Sub

Private Sub CreateItem(Width As Int, Title As String, Image As String, Content As String) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    Dim height As Int = 280dip
    If GetDeviceLayoutValues.ApproximateScreenSize < 4.5 Then height = 310dip
    p.SetLayoutAnimated(0, 0, 0, Width, height)
    p.LoadLayout("Card1")
    lblTitle.Text = Title
    lblContent.Text = Content
    SetColorStateList(lblAction1, xui.Color_LightGray, lblAction1.TextColor)
    SetColorStateList(lblAction2, xui.Color_LightGray, lblAction2.TextColor)
    ImageView1.SetBitmap(xui.LoadBitmapResize(File.DirAssets, Image, ImageView1.Width, ImageView1.Height, True))
    Return p
End Sub

How can i add individual text to each card ?
 

GMan

Well-Known Member
Licensed User
Longtime User
As i wrote: solved
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
No problem.
I realized it by adding additional labels to the Card1.bal and simply enhance the given structure with content2,content3 and content4
 
Upvote 0
Top