B4J Question Custom listviews resizing

moore_it

Well-Known Member
Licensed User
Longtime User
Hi all,
i've created a listview and populate with anchorpanes, when i enlarge the form listview enlarge all items, when i scale down the form, the listview items not resizing keep the last width.

It's a bug or i my mistake ?
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Tested using this example by adding some anchorpanes for which resizing of the form works fine.
The listview is added using the B4J Internal Designer.
The listview horz & vert anchors are set to both!
B4X:
  Private listviewMain As ListView
  ...
  For i = 0 To 100
     Dim ap As AnchorPane
     ap.Initialize("ap")
     CSSUtils.SetBorder(ap,5,fx.Colors.Blue,5)
     listviewMain.Items.Add(ap)
   Next


 
Upvote 0

moore_it

Well-Known Member
Licensed User
Longtime User
I use the same technique

but ....


enlarge


shrink



not resize.
The difference from you, i use a layout in the anchorpane.
 
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
Then try, like below: Load the layout aplayout.bjl in a pane which is added to the anchorpane - then the anchors are set for pane child of the anchorpane.
B4X:
For ...
    Dim ap As AnchorPane
    ap.Initialize("ap")
    Dim p As Pane
    p.Initialize("p")
    p.LoadLayout("aplayout")
    ap.AddNode(p,0,0,-1,50)
    ap.SetAnchors(p,0,0,0,0)
    listviewMain.Items.Add(ap)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…