Android Question Gesture Detector doesn't work with CustomListView

MrKim

Well-Known Member
Licensed User
Longtime User
CustomListView uses a scrollview and I can't get it to work?

Unless I am looking at the wrong customlistview?
https://www.b4x.com/android/forum/threads/customlistview-a-flexible-list-based-on-scrollview.19567/


Code:
Sub Class_Globals
....
....Dim GD AsGestureDetector, DiscardOtherGestures As Boolean, FilterMoveEvents As Boolean
End SubPublic Sub Initialize (vCallback As Object, vEventName AsString)
sv.Initialize2(0, "sv")
items.Initialize
panels.Initialize
dividerHeight = 2dip
EventName = vEventName
CallBack = vCallback
sv.Color = 0xFFD9D7DE'this sets the dividers colorDim r AsReflectorDim idPressed As Int
idPressed = r.GetStaticField("android.R$drawable", "list_selector_background")
r.Target = r.GetContext
r.Target = r.RunMethod("getResources")
pressedDrawable = r.RunMethod2("getDrawable", idPressed, "java.lang.int")
DefaultTextColor = Colors.White
DefaultTextSize = 16
DefaultTextBackgroundColor = Colors.Black
DefaultTextBackground = Null

GD.SetOnGestureListener(sv, "Gesture")End Sub
....
......
 

LucaMs

Expert
Licensed User
Longtime User
I have not tried but you definitely have to handle gestures on the internal panel of the ScrollView, not the ScrollView itself.
(sv.Panel).


[Please use the CODE tags to post source code]
upload_2017-6-16_10-17-24.png
 
Last edited:
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
What is not working? What are you trying to do?
Figured it out. On a listview SetOnGestureListener will work binding it to the Listview, with scroll view you have to bind it to the individual panels that you add.
 
Upvote 0
Top