Android Question Best option to add a layout with size variable on CustomListView?

Alberto Iglesias

Well-Known Member
Licensed User
Hello all,

Anyone knows what's the best solution to put some layout with size variable on CustomListView?

My scenario:

I have a layout with one image, and this image is resizable according with width of screen, so, this image grow to keep square depending of width:


and I dont want to show this space on CustomListView between on row and another

the problem is this iHeight related below:

What's the best option to calculate the height of this new panel with this layout?

    Dim p As Panel = xui.CreatePanel("")
    p.SetLayoutAnimated(  0, 0, 0, pCLV.AsView.Width, iHeight)
    pCLV.Add(p, "")

Thanks in advance

Alberto Iglesias

Well-Known Member
Licensed User
My solution was:

First, put this methods on CustomListView:

public Sub SetScrollViewInnerHeight(Height As Double)
    sv.ScrollViewContentHeight = Height
End Sub

public Sub GetScrollViewInnerHeight() As Double
    Return sv.ScrollViewContentHeight
End Sub
and in the code, after loading the panel with layout, I decrease the height based on components of this new layout, look:

    Dim dMax As Double
    For Each v As View In p.GetAllViewsRecursive
        If (v.Top + v.Height) > dMax Then dMax = v.Top + v.Height
    Dim iCLVHeight As Double = iHeight - (dMax+5dip)
    pCLV.SetScrollViewInnerHeight(pCLV.GetScrollViewInnerHeight - iCLVHeight)
Is working fine, but I need to know if is this a best pratice to do that!