Android Question Resize panel height to fit label with long text

cenyu

Active Member
Licensed User
Longtime User
Hello, i have problem with resizing panel to fit label with long text. My code is this:
B4X:
        lblDescription.Text = m.Get("BookFullDescription")
        lblDescription.TextSize = 18
       
        Dim h As Int = stu.MeasureMultilineTextHeight(lblDescription, lblDescription.Text)
        lblDescription.Height = h
        pnlMain.Height =pnlMain.Height + h

As you can see i use StringUtils to meashure text height and then i try to resize panel but no success. Panel do not resize.
Can you help?
 
Last edited:

cenyu

Active Member
Licensed User
Longtime User
I found the problem!
After resizing pnlMain i forgot to resize ScrollView...
The full working code is this:

B4X:
Dim h As Int = stu.MeasureMultilineTextHeight(lblDescription, lblDescription.Text)
        
        lblDescription.Height = h
        pnlMain.Height = (pnlMain.Height + h)
        scvMain.Panel.Height = scvMain.Panel.Height + h
 
Upvote 0
Top