Android Question IMAGES ON XCUSTOM LIST VIEW

Lupos

Member
Good evening everyone.
Most likely this topic has already been discussed but I didn't find any useful answers in the forum.
I can't insert images into items in a horizontally scrolling Xcustomlistview.
I tried modifying the example program in several ways without getting the result.
The only result I get is the same image for all items or no image at all.
Any suggestions?
Attached is a small test program.
Thanks in advance.
 

Attachments

  • 1_xCustomListView.zip
    17.8 KB · Views: 104

DonManfred

Expert
Licensed User
Longtime User
The only result I get is the same image for all items or no image at all.
You are NOT loading any Image here
B4X:
    ImageViews.Initialize
    For i = 1 To 20
        clv2.Add(CreateListItem($"Item #${i}"$, clv2.AsView.Width, 10dip), $"Item #${i}"$)
        'im1(0).Bitmap = LoadBitmapResize(File.DirAssets, "Smiley.png", im1.Width, im1.Height, True)
    Next

change it to

B4X:
    ImageViews.Initialize
    For i = 1 To 20
        clv2.Add(CreateListItem($"Item #${i}"$, clv2.AsView.Width, 10dip), $"Item #${i}"$)
        im1.Bitmap = LoadBitmapResize(File.DirAssets, "Smiley.png", im1.Width, im1.Height, True) ' im1 is the imageview loaded in CreateListItem. Just load a image to it.
        ImageViews.Add(im1) ' add the imageview to your list
    Next

BTW: There is NO NEED to write the threadtitle all in UPPERCASE!
 
Upvote 1

Lupos

Member
You are NOT loading any Image here
B4X:
    ImageViews.Initialize
    For i = 1 To 20
        clv2.Add(CreateListItem($"Item #${i}"$, clv2.AsView.Width, 10dip), $"Item #${i}"$)
        'im1(0).Bitmap = LoadBitmapResize(File.DirAssets, "Smiley.png", im1.Width, im1.Height, True)
    Next

change it to

B4X:
    ImageViews.Initialize
    For i = 1 To 20
        clv2.Add(CreateListItem($"Item #${i}"$, clv2.AsView.Width, 10dip), $"Item #${i}"$)
        im1.Bitmap = LoadBitmapResize(File.DirAssets, "Smiley.png", im1.Width, im1.Height, True) ' im1 is the imageview loaded in CreateListItem. Just load a image to it.
        ImageViews.Add(im1) ' add the imageview to your list
    Next

BTW: There is NO NEED to write the threadtitle all in UPPERCASE!
Thanks for the answer and sorry for the uppercase :)
 
Upvote 0
Top