B4A Library CLVNested - Allows nesting CLVs

Discussion in 'Additional libraries, classes and official updates' started by Erel, Jul 17, 2019.

  1. Erel

    Erel Administrator Staff Member Licensed User


    Putting a CLV inside another one will not work out of the box. The inner list will not be scrollable.

    CLVNested makes it possible.


    - One list per item.
    - The user will not be able to interact with the inner list views.
    - Will not work with other extensions that "steal" the touch events such as CLVSwipe.


    1. Initialize the CLVNested object.
    2. Load the layout with the main list to nested.base.
    3. Set the main list with:
    nested.CLV = CustomListView
    4. Add the items. If you want to add items with inner lists then you need to set the panel's tag to point to the list.

    Complete example:
    Sub Globals
    Private CustomListView1 As CustomListView
    Private clvItem As CustomListView
    Private xui As XUI
    Private nested As CLVNested
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
       nested.CLV = CustomListView1
    For i = 1 To 10
    $"*** TITLE (${i}) ***"$"")
    Dim p As B4XView = xui.CreatePanel("")
           p.Tag = clvItem 
    'must set the Panel tag like this
    End Sub

    Sub FillInnerList
    For x = 1 To 10
    $"Item #${x}"$, x)
    End Sub
    Depends on ViewsEx library.

    Note that such solution is not required in B4i or B4J. The standard xCLV will suffice.


    v1.10 - Adds support for nested horizontal CLVs.

    Attached Files:

    Last edited: Dec 5, 2019 at 7:56 AM
  2. Erel

    Erel Administrator Staff Member Licensed User

    v1.10 - Adds support for nested horizontal CLVs.
    Beja, vecino and LucaMs like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice