B4J ListView can hold simple items like strings or numbers and also customized items.
The core ListView is similar to both B4A ListView and CustomListView class.
Adding custom items is done by adding Nodes to the ListView items collections.
Instead of showing the item "value" the Node itself will be displayed.
The Node can be an AnchorPane that holds other nodes or it can be any other node type as well.
For example to create a list that shows the available fonts:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private lv As ListView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
lv.Initialize("lv")
MainForm.RootPane.AddNode(lv, 0, 0, 0, 0)
MainForm.RootPane.SetAnchors(lv, 0, 0, 0,0)
For Each family As String In fx.GetAllFontFamilies
Dim lbl As Label
lbl.Initialize("")
lbl.Text = family
lbl.Font = fx.CreateFont(family, 22, False, False)
lv.Items.Add(lbl)
Next
End Sub
Sub lv_SelectedIndexChanged(Index As Int)
If Index > -1 Then
Dim lbl As Label = lv.SelectedItem
Log(lbl.Text)
End If
End Sub
A more complicated example is attached. It uses ImageDownloader to download a list of images (similar to this B4A example:
http://www.b4x.com/android/forum/th...ple-way-to-download-images.30875/#post-179512 )
Note that the images show when they are ready.
This feature depends on v1.00 (beta 5+).