Android Question Add many panel to CLV

Blue.Sky

Active Member
Licensed User
Longtime User
Hi
I have a panel for show product
I can detect count of panel in each row
Example for 4 inch device,i must add 2 panel
I can add panel(product) and each row successfully
but i want to use CustomListView in my app for speed up app
How can i add many panel in each row when i using CLV?
 

Blue.Sky

Active Member
Licensed User
Longtime User
You can add as many panels as you like to the base panel.
I know.
But i want to add 2 panel in one row but in this module i can add one panel with Add method
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
You should create Items to add to a CLV; each Item is a panel, which can contain how many views you want of any type (then also two or more panels):
Something like:
B4X:
  Private clv As CustomListView

  Dim PanelItemHeight...

  For i = 0 To 9
     clv.Add(CreateItem, PanelItemHeight, "Item" & i)
  Next

  Private Sub CreateItem As Panel
     Dim pnlItem As Panel
     ...
     Dim pnl1, pnl2, pnl3...
     ...
     pnlItem.AddView(pnl1,...)
     pnlItem.AddView(pnl2,...)
     ...
     Return pnlItem
  End Sub


You can also create items' layouts by Designer and load them into items (the layout can contain two or more panels, of course)
B4X:
  For i = 0 To 9
     Dim pnlItem As Panel
     pnlItem.Initialize...
     pnlItem.LoadLayout(...)
     clv.Add(pnlItem, PanelItemHeight, "Item" & i)
  Next
 
Last edited:
Upvote 0

Blue.Sky

Active Member
Licensed User
Longtime User
You should create Items to add to a CLV; each Item is a panel, which can contain how many views you want of any type (then also two or more panels):
Something like:
B4X:
  Private clv As CustomListView

  Dim PanelItemHeight...

  For i = 0 To 9
     clv.Add(CreateItem, PanelItemHeight, "Item" & i)
  Next

  Private Sub CreateItem As Panel
     Dim pnlItem As Panel
     ...
     Dim pnl1, pnl2, pnl3...
     ...
     pnlItem.AddView(pnl1,...)
     pnlItem.AddView(pnl2,...)
     ...
     Return pnlItem
  End Sub


You can also create items' layouts by Designer and load them into items (the layout can contain two or more panels, of course)
B4X:
  For i = 0 To 9
     Dim pnlItem As Panel
     pnlItem.Initialize...
     pnlItem.LoadLayout(...)
     clv.Add(pnlItem, PanelItemHeight, "Item" & i)
  Next
This is best solution
 
Upvote 0
Top