Android Question layout is not resizing

Alexander Stolte

Expert
Licensed User
Longtime User
Hello,

i have a simple layout, a label with anchors in both directions
1586700771078.png

I load this layout to a panel.
Then i change the panel height per code, but the label is not resizing.

This is the code to get the panel:
B4X:
Public Sub BodyPanel As B4XView
    Return xpnl_card_body   
End Sub
and with this code i load the layout to the panel:
B4X:
asdbc_main.BodyPanel.LoadLayout("frm_body")

What am I doing wrong?

Greetings
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The anchors and designer script are only applied once when the layout is loaded (in B4J and B4i it is different).
asdbc_main.BodyPanel.LoadLayout("frm_body")
This code is wrong and hints that your component design is also wrong. The layout should be loaded from inside the class. Otherwise the events will not be handled in the class.

Best way is to implement it as a XUI custom view.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
thats a problem, because i have 2 sizes: Half Expanded and Full Expanded.
Maybe i should to force the user to load 2 layouts for the 2 heights, the layout can be the same, but the height is different.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
You just need to make sure that the panel is sized correctly before the layout is loaded.
That's not the problem, my problem is this:
20-04-04-13-55-05.gif

Half expanded and full expanded
The first mode is half, the layout is resized for the half size, if the user drag it to top, then the layout height must be bigger
 
Upvote 0
Top