Hi devs,
In my B4J project I have a layout applied to a CustomListView item panel.
In the layout I defined a button with a bottom-right anchor.
When the item is programmatically added to the list the button is not bottom-right aligned.
It goes in the right place only if I resize the form.
The code where the item is created:
B4X:
Private Sub CreateListItem(document As Document) As B4XView
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 0, 120)
p.LoadLayout("cellitem")
Label1.Text = DateUtils.TicksToString(document.Date)
lblDescription.Text = document.Description
Return p
End Sub
Hi Erel,
you are right but it's not the cause of the problem.
Even if I set width to a different value the problem remains.
Now I tried to anchor at top-right ... look at the result before and after a resize.
P.S. how can I set the width to fit all the available space? 100%x doesn't work in B4J.
With a brand new program I can't reproduce.
So I created a new layout with the same controls and it works fine. That meas the problem is the layout but I can't understand where.
If you are curious and want to have a look I attach the layouts.
cellitem.bjl -> anchor problems
layouttest.bjl -> works fine