Android Question xCustomListView dynamically adjust for content


New Member
I was looking at the example Erel did

However on my phone as mentioned lblContent of Card1.bal does not increase the size based on its contents.

Is there an easy way to get the size and increase the panel height ?

The above is one example but in my user case I was thinking of having a dynamically size B4XTable which may have varying rows.

Would that size and adjust the panel ?

Apologise if the answers is obvious but pretty new to B4X

Andrew (Digitwell)

Well-Known Member
Licensed User
you can use the code from this forum post as a basis for resizing a label based on contents

The key is the MeasureMultiTextHeight function

Public Sub MeasureMultiTextHeight(lbl As Label, width As Int, text As Object) As Int
    #if b4a
    Private su As StringUtils
    Return su.MeasureMultilineTextHeight(lbl, text)
    #else if b4i
    Dim plbl As Label
    plbl.Width = width
    plbl.Multiline = True
    Return plbl.Height
    #End If
End Sub
Upvote 0