Android Question Change dynamically height in CLV Item

ggranata

Member
Hi,
In my layout, I have defined a CustomListView and dynamically I populate the CLV with panels.
How can I set different heights for CLV items?
Can I change item height after CLV.Add?
 

Attachments

  • clvitem.PNG
    clvitem.PNG
    12.8 KB · Views: 281
  • Screenshot_1588001699.png
    Screenshot_1588001699.png
    104.2 KB · Views: 276

mangojack

Expert
Licensed User
Longtime User
I believe it would be simpler to calculate the desired panel height prior to loading the item.
Then just pass the reqired panel height.

Using the xCLV example...
B4X:
For i = 1 To 10
        Dim Height As Int
        If i Mod 2 = 0 Then
            Height = 100
        Else 
            Height = 70            
        End If
        
        clv1.Add(CreateListItem($"${i}"$, clv1.AsView.Width, Height), $"Item #${i}"$)
    Next
 
Upvote 0
Top