B4J Question Anchor in CustomListView item

christiantric

Member
Licensed User
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

Should I call a resize programmatically? And how?

Thanks in advance,
Christian
 

christiantric

Member
Licensed User
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.
 

Attachments

  • before_resize.jpg
    before_resize.jpg
    14.2 KB · Views: 164
  • after_resize.jpg
    after_resize.jpg
    15.9 KB · Views: 163
Upvote 0

christiantric

Member
Licensed User
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

Bye.
 

Attachments

  • layouts.zip
    2.7 KB · Views: 174
Upvote 0
Top