Android Question Can I load full layout into Custom listview?

Pravee7094

Active Member
Hi all,
Can I load full layout into custom listview like this

B4X:
'globel
Dim ScrollView1 As ScrollView

'activity create
Activity.LoadLayout("scrollview")
ScrollView1.Panel.LoadLayout("entry_customer")
ScrollView1.Panel.Height = ip_fullpanel.Height

If possible, Is there any code snippet?
Because only I want scrollview from custom list view.

Thanks
Praveen
 

josejad

Expert
Licensed User
Longtime User
Can I load designer layout in customlist view?
Of course, you load a layout for every item.

Check this example:


B4X:
    ...
    For i = 1 To 20
        clv2.Add(CreateListItem($"Item #${i}"$, clv2.AsView.Width, 60dip), $"Item #${i}"$)
    Next
    ...

Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, Width, Height)
    p.LoadLayout("CellItem")   '<----- HERE YOU LOAD YOUR LAYOUT
    Label1.Text = Text
    Return p
End Sub
 
Last edited:
Upvote 0

Pravee7094

Active Member
Of course, you load a layout for every item.

Check this example:


B4X:
    ...
    For i = 1 To 20
        clv2.Add(CreateListItem($"Item #${i}"$, clv2.AsView.Width, 60dip), $"Item #${i}"$)
    Next
    ...

Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, Width, Height)
    p.LoadLayout("CellItem")   '<----- HERE YOU LOAD YOUR LAYOUT
    Label1.Text = Text
    Return p
End Sub
Thank you so much
 
Upvote 0
Top