Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private hsv1 As HorizontalScrollView
Private leftpos As Int
Private clv1 As CustomListView
Private numlists As Int = 5
End Sub
Public Sub Initialize
B4XPages.GetManager.LogEvents = True
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
hsv1.Panel.RemoveAllViews
leftpos = 0dip
Log(hsv1.Width)
For i = 1 To numlists
Dim clv As CustomListView = set_clv(i)
Dim lbl As Label
lbl.Initialize("lbl")
lbl.Tag = "List:" & i
lbl.Text = "List number: " & i
lbl.TextColor = Colors.Black
lbl.Padding = Array As Int (10dip, 10dip, 10dip, 10dip)
lbl.Typeface = Typeface.DEFAULT_BOLD
lbl.Color = Colors.ARGB(255,200,201,255)
hsv1.Panel.AddView(lbl,leftpos+5dip,0,hsv1.Width-10dip,45dip)
hsv1.Panel.AddView(clv.AsView,leftpos+5dip,50dip,hsv1.Width-10dip,hsv1.Height)
clv = fill_clv(i,clv)
leftpos = leftpos + hsv1.Width
Next
hsv1.Panel.Width = ((i-1)*hsv1.Width)
End Sub
Private Sub set_clv(ipnl As Int) As CustomListView
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, hsv1.Width, hsv1.Height)
p.LoadLayout("clv1_layout")
clv1.AsView.RemoveViewFromParent
Return clv1
End Sub
Private Sub fill_clv(icnt As Int, mclv As CustomListView) As CustomListView
For x = 0 To 20
mclv.AddTextItem("list: "&icnt&" item: "&x,icnt&"|"&x)
Next
Return mclv
End Sub
Private Sub hsv1_ScrollChanged(Position As Int)
'Log(Position)
End Sub
Private Sub clv1_ItemClick (Index As Int, Value As Object)
Log(Value)
End Sub
Private Sub lbl_Click
Dim lbl As Label = Sender
Dim tag As String = lbl.tag
Log(tag)
End Sub