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

upload_2017-4-27_13-7-50.png

upload_2017-4-27_13-8-26.png
 
Upvote 0

moore_it

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

but ....
upload_2017-4-27_13-17-54.png


enlarge
upload_2017-4-27_13-19-33.png


shrink

upload_2017-4-27_13-20-24.png


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
Top