Android Question Access panel in CLV to create another CLV

Roger C

Active Member
Licensed User
Longtime User
Hi,

Full project supplied.

From the example https://www.b4x.com/android/forum/t...t-based-on-xcustomlistview.86449/#post-547401

I've removed the buttons and placed a CLV there instead.
What I need is a list of Headers with a textline and the animated Arrow. as in picture "CLV Closed".
These could be 1 entry or up to 20 entries.

When you open a Header it should load the Layout 'Depart' in different quantities. These could be non or up to 30 new entries.

So from start, I shall only create the Headers with empty information in the hidden CLV. Then when a Header is expanded, the CLV should be filled with information.
As in picture 'CLV Expanded'. There I managed to get one entry but I think I'm doing it wrong since the CLV doesn't get the entry, rather the Panel behind....

I try to access the CustomListView in the Layout 'Item', to be able to add more views inside the CLV.

B4X:
Sub ExpandItem (index As Int)
    'Dim id As ItemData = clv1.GetValue(index)
    Log("Expand item")
    
    'Fill CLV
    Dim Icon1 As Bitmap
    Dim id As ItemData = clv1.GetValue(index)    '.GetView(1).GetView(0)
    Dim iv As B4XView = clv1.GetPanel(index).GetView(1)   '.GetView(0)       
    
    Log ("id = " & id)
    Log ("iv = " & iv)
    
    'CLVdep.Add(CreateItemDep(0xff,"New dep",id),id)
    
    
    For i = 1 To 8
            
        iv.LoadLayout("Depart")
        
        Icon1.Initialize(File.DirAssets, "train.jpg")
        ivTransport.Initialize("ivTransport")
        ivTransport.Bitmap=Icon1
        ivTransport.Gravity=Gravity.FILL
        Log("Bitmap = " & Icon1.Width & " x " & Icon1.Height)
        
        lblDest.text="173 - Liljeholmen"
        lblTime.text= "3 min"
        'iv.Color=0xFFFF0000
    Next

    clv1.ResizeItem(index, id.ExpandedHeight)       
    clv1.GetPanel(index).Tag = True
    AnimatedArrow(index, 0, 180)
End Sub


I have tried all possible combinations in this line:
Dim iv As B4XView = clv1.GetPanel(index).GetView(1) '.GetView(0)
...but I can't access the Add-function from CLV.

I have an empty CLV and need to add several posts to that with the Layoutfile "Depart".
I can do it once but I can't create new entries in the CLV called CLVdep.

Any help where I go wrong?
 

Attachments

  • Proj V1-190220.zip
    30.5 KB · Views: 269
  • CLV closed.jpg
    CLV closed.jpg
    155.6 KB · Views: 292
  • CLV expanded.jpg
    CLV expanded.jpg
    136.7 KB · Views: 280
  • Designer.jpg
    Designer.jpg
    95.6 KB · Views: 274
Top