B4A Library [B4X] Expander v2 : Expandable CustomListView

Expander : Expandable CustomListView based on Erel's Expandable List View, xCustomListView and XUI

I needed to modify Expandable List View to customize it to my need and hence this Library.

Features:
~ Easy to Configure. No layouts. No Images.
~ Does not use layout. So it is slightly faster with long lists.
~ Accepts CharSequence for Title and Body.
~ Designed for Text items. Add items by defining Title and Body as either Text/Charsequence. Custom Panels can also be added.
~ Auto Resizing based on text. [Put 0 as Collapsed or Expanded Height for auto Resize]
~ Easy to modify Arrow Symbol [ No Image needed (uses FontAwesome) & you can change size and color ]

Expander
Version:
2
Author: epiCode
  • Methods:
  • Initialize As void
    Initializes the fields to their default value.
Expander
Fields:

  • designerTitle As B4XView Use this to modify Title properties
  • designerBody As B4XView Use this to modify Body properties
  • openSingleItem As boolean Will collapse last panel before expanding a new one
  • padding As int Padding around body text
  • titleShadow As int Title Shadow
  • titleEdgeGap As int Title Edge Gap
  • titleRoundness As int Rounded Corners
  • arrowSymbol As char Arrow Symbol from fontawesome as Char
  • arrowColor As int Arrow Color
  • arrowSize As int Arrow Size
Methods:
  • IsInitialized As boolean Tests whether the object has been initialized.
  • _additem (iTitle As Object, iBody As Object, Collapsed As int, Expanded As int) As String
    Add item to selected CLV
    Collapsed and Expanded are height. Set heights to 0 for auto resize
    Modify DesignerTitle or DesignerBody to change attributes of Title and Body
    Please note there is default padding of 4dip in both Title and Body.
Properties:
  • showSingle As boolean Expand single item only. [Closes last one]


Depends on these Libraries:
LineUtils v1.2
XUI


PM for Source (Payware)
 

Attachments

  • ExpanderV2Ex.zip
    9.7 KB · Views: 201
  • Expander.png
    Expander.png
    91.1 KB · Views: 432
  • ExpanderLibsV2.zip
    8.5 KB · Views: 199

epiCode

Active Member
Licensed User
Hello epiCode,

Can panel with controls instead of long text?
Yes you can!

Every panel in CLV1.getpanel(Index) has a structure like this


B4X:
MainPanel                    'Returned by CLV1.getPanel(Index)
    PanelTitle                'Returned by CLV1.getPanel(Index).Getview(0)
        LabelTitle            'Returned by CLV1.getPanel(Index).Getview(0).getview(0)
        imgArrow            'Returned by CLV1.getPanel(Index).Getview(0).getview(1)
    LabelBody                'Returned by CLV1.getPanel(Index).Getview(1)

Mainpanel.tag contains expandable type with following structure:
 Type ExpandableItemData (CollapsedHeight As Int, ExpandedHeight As Int, Title As Object, Body As Object, Expanded As Boolean)

It makes sense to do simple modifications here like adding a badge / button "while" retaining text features
If the panel you wish to add is complex and text features are not utilized then it is better to use the original example created by Erel as shared in the link above.
 
Top