Android Question Resizing a CustomListView in code

Martin Larsen

Active Member
Licensed User
Longtime User
I need to reposition af CustomListView in code. There is a panel at the top of the activity which is only visible at some conditions, and I need to move and resize the CLV to expand the full area if that panel is not visible.

The following code will only change the top of the CLV. The height is not affected. In other words, the top of the CLV is positioned correctly, but the CLV does not expand to fit the full view.

B4X:
If Panel1.Visible Then
    CLV.AsView.Top = Panel1.Height
Else
    CLV.AsView.Top = 0
End If
CLV.AsView.Height = Activity.Height - CLV.AsView.Top

The strange thing is that I can only set a height that is less than the initial height. That works. But for some reason the CLV cannot be higher than designed. The height property itself does change if I check it with Log(), but visually there is no change.

What do I do wrong?
 
Top