Android Question Pictures in the CustomListView

johnerikson

Active Member
Licensed User
Longtime User
Is it possible to add pictures in the CustomListView class
In the Example of CustomListView class, there are no pictures (bitmaps)
If it possible, how?
 

udg

Expert
Licensed User
Longtime User
Yes, you can add pictures. CLV is a very flexible object.
Just keep in mind that each CLV's item is a panel, so if you add an ImageView to your panel you'll see it when that panel is displayed (as part of the CLV).

An easy way to add elements to CLV's items is using the Designer to prepare a layout made up of all the items you want to show on a panel, then use that layout on the panel you add to the CLV. Different items could refer to different layouts.
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
Thanks, it works
I add an Imageview in designer and change the code in the example like this

B4X:
Sub CreateListItem(sImage As String, Text As String, Width As Int, Height As Int) As Panel
    Dim p As Panel
    p.Initialize("")
    p.SetLayout(0, 0, Width, Height)
    p.LoadLayout("CellItem")
    ImageView1.SetBackgroundImage(LoadBitmapResize(spathRot, sImage, ImageView1.Width, ImageView1.Height, True))
    Label1.Text = Text
    Return p
End Sub
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
Thanks a lot!
It works. There seems to be no limit to possibilities, limitations is difficulties to find them!
 
Upvote 0
Top