Android Question CustomListView Item Resize Problem (Solved)

walterf25

Expert
Licensed User
Longtime User
Hi all, i am currently using the CustomListview.bas module version 1.66 and i can't figure out why i am seeing a bigger space between the first item and the second item in the ListView and then the space between between the items after the second item look the same, attached is my code and also an image of the issue i am seeing, can anyone tell me why that is?

B4X:
Sub BuildItems(params As List)
    If imagelist.Size = 0 Then Return
    clv.Clear
    Dim m As Map
    m.Initialize
    Dim i As Int = 0
    For Each link As String In imagelist
        ''Dim su As StringUtils
        Dim p As Panel
        p.Initialize("")
        ''Dim pp As Panel
        Dim split() As String
        If params.get(i) <> "" Then
        split = Regex.Split("~", params.Get(i))
        clv.add(p, link & "~" & split(0) & "~" & split(1))
        p.LoadLayout("coaches")
        pnlmain.Color = Colors.RGB(174, 209, 234)
        lbltitle.Text = split(0)
        lbldescription.Text = split(1)
        SetEllipsize(lbldescription, "END")
        clv.DefaultTextBackgroundColor = Colors.RGB(174, 209, 234)
        m.Put(imgcoach, link)
        clv.ResizeItem(i, 130dip)
        i = i + 1
        End If
    Next
    i = 0
    CallSubDelayed2(ImageDownloader, "Download", m)
End Sub

And here is the image of the issue so you can get a better idea of what it is i'am talking about.

As you can see the space between the First Item and the Second Item is more than the spacing between the second and third items.
I'm sure is something fairly easy but i just can't point my finger on it, any ideas, suggestions?

Thanks All,
Walter
 

walterf25

Expert
Licensed User
Longtime User
Solved it, the problem was that I had to give the panel it's dimensions right after initializing it.

B4X:
Dim p As Panel
p.Initialize("")
p.SetLayoutAnimated(0, 0, 0, 100%x, 120dip)

Walter
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…