Android Question How to dynamically change xCustomListView's size?

Binary01

Active Member
Licensed User
Longtime User
Hello,

In my app, I load a layout that contains xCustomListView into myMainPanel.
B4X:
myMainPanel.LoadLayout("mycustomlistviewlayout")

In layoutscript
B4X:
      myListView.SetTopAndBottom(1dip, 100%y)
      myListView.SetLeftAndRight(1dip,100%x)
I already changed Horizontal Anchor and Vertical Anchor properties are set Both for
myListView (xCustomListView)

In my Main Activity, a button is clicked, myMainPanel's height is changed.
B4X:
    Sub btn1_Click
        myMainPanel.BringToFront
        myMainPanel.SetLayoutAnimated(200, myMainPanel.Left, myMainPanel.Top, myMainPanel.Width, 60%y)
     End Sub

When I clicked btn1, myMainPanel's height is changed, but myListView's height is not changed. I want to change xCustomListView's size, not item's height.

How can I fix it?

Thanks.
 
Last edited:

Binary01

Active Member
Licensed User
Longtime User
Anchors and designer script are only applied when the layout is loaded (in B4A).

You need to change the size yourself:
B4X:
CLV.AsView.SetLayoutAnimated(0, ...)
CLV.Base_Resize(CLV.AsView.Width, CLV.AsView.Height)

Thank Erel.

It's working.
 
Upvote 0
Top