Sub Globals
Private xLV As xListView
Private lblTitle As Label
Private lblTime As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("L1")
xLV.selectionColor = Colors.Cyan
xLV.OffscreenItems=5 'Default = 5, change it before adding items
xLV.SetScrollbarColor(Colors.Blue)
xLV.HideScrollBar(False) ' Set True to hide Scrollbar
End Sub
Sub xLV_PanelRequested(Index As Int)
'Load the panel here , the panel will be automatically removed when it's not visible (don't remove it manually)
Dim P As Panel
P.Initialize("")
P.SetLayout(0,0,xLV.AsView.Width,180dip)
P.LoadLayout("ItemLayout") 'Disable animation from the Visual Designer for more smooth scrolling
lblTitle.Text= "Item Number : " & Index
xLV.LoadPanel(P,Index)
End Sub
Sub Button1_Click
Dim B As Button=Sender
B.Text="Clicked"
End Sub
Sub xLV_ItemClick (Index As Int, Value As Object)
ToastMessageShow("Item " & Index & " Clicked",False)
End Sub
Sub xLV_ItemLongClick (Index As Int, Value As Object)
ToastMessageShow("Item " & Index & " Long Clicked",False)
End Sub
Sub btnAddItems_Click
Dim ms As Long = DateTime.Now
For i = 1 To 10000
xLV.NewItem(180dip,i)
Next
xLV.Reload ' you must call reload after adding new items
lblTime.Text = "Load Time : " & (DateTime.Now - ms) & " ms - Total Items : " & xLV.Size
End Sub