I took the original CLVSnap code from @Erel and modified it to create a new class.
With this class you can decide if you want to have an instant snap or if you want the list to snap only when the list stops moving.
I spend a lot of time in creating views, some views i need by my self, but some views not and to create a high quality view cost a lot of time. If you want to support me, then you can do it here by Paypal or with a coffee.
It is compatible with B4A, B4i and B4J.
Note that you need to call snap.ScrollChanged from the ScrollChanged event.
On B4I you needGestureRecognizer Download the .bas file in the attachment
Default: False
If False then the snap works like the original CLVSnap Class.
SnapCLVAdvanced
Author: Alexander Stolte
Version: 1.00
Changelog
With this class you can decide if you want to have an instant snap or if you want the list to snap only when the list stops moving.
I spend a lot of time in creating views, some views i need by my self, but some views not and to create a high quality view cost a lot of time. If you want to support me, then you can do it here by Paypal or with a coffee.
It is compatible with B4A, B4i and B4J.
Note that you need to call snap.ScrollChanged from the ScrollChanged event.
On B4I you need
B4X:
AdvancedSnap.InstantSnap = True
If False then the snap works like the original CLVSnap Class.
Example:
For i = 0 To 50 -1
Dim xpnl As B4XView = xui.CreatePanel("")
xpnl.Color = Rnd(0xff000000, 0xffffffff)
xpnl.SetLayoutAnimated(0, 0, 0, CustomListView1.AsView.Width, Rnd(200dip, 300dip))
CustomListView1.Add(xpnl, "")
Next
AdvancedSnap.Initialize(CustomListView1)
AdvancedSnap.InstantSnap = True
...
Sub CustomListView1_ScrollChanged (Offset As Int)
AdvancedSnap.ScrollChanged(Offset)
End Sub
SnapCLVAdvanced
Author: Alexander Stolte
Version: 1.00
Changelog
- 1.00
- Release
Attachments
Last edited: