Android Question How To Change CustomListView Item Display Height On ItemClick

Richard Goh

Active Member
Licensed User
Longtime User
I have a CustomListView populated with items. I would like to change the display height in the CustomListView when the item is clicked. Just to change the display height with existing controls in the item panel. Eg. I populate the list of items with 40dip height and I want to change the selected item height to display 100dip when its clicked. Any advice or suggestion on how can I do it? Thanks in advance.
 
Last edited:

Richard Goh

Active Member
Licensed User
Longtime User
Hi Erel,

I tried that before and having below problem. What I need is to have expand and collapse function on the items to show extra contents for the items.
I was thinking on just change the CustomListView item height (as per remarked line) without remove and re-insert them.

Error occurred on line: 140 (CustomListView)
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

B4X:
Sub clv_ItemClick (Index As Int, Value As Object)
    ToastMessageShow("Item clicked = " & Index, False)
    Dim p As Panel
    p = clv.GetPanel(Index)
  
    clv.RemoveAt(Index)
    clv.InsertAt(Index, p, 80dip, Value)

'    clv.GetPanel(Index).GetView(0).Height = 80dip   
    clvIndex = Index
End Sub
 
Upvote 0
Top