Android Question Swipe panels

ThePuiu

Active Member
Licensed User
Longtime User
I have a ScrollView where I dynamically add more panels. I want each of the panels to accept swipe (similar to Mail messages). How can I simulate this behavior?
Thank you!
 

Emme Developer

Well-Known Member
Licensed User
Longtime User
I have a ScrollView where I dynamically add more panels. I want each of the panels to accept swipe (similar to Mail messages). How can I simulate this behavior?
Thank you!
You can use gesture detecture library.
Otherwise, you can create your custom effect. Put horizzontal scv instead of panel and center it. Inside it put the panel and play with different color or other to simulate same effect
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
With the Gesture library it seems quite simple but in Gesture_onDrag I do not have a reference to the swipe panel ... how can I know about which panel is it?
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
Can't anyone give me an idea how can I know which panel is swipe?
I'm stuck with the project ...
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Show us some code and we might be able to help.

iirc you can either digest the gesture or pass it through to an underlying panel or something like that.
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
the code is very simple:
B4X:
For i = 0 To 100
    Dim PanelComanda As Panel
    PanelComanda.Initialize("PanelComanda")
    PanelComanda.Height = 80dip
    PanelComanda.Color = Colors.ARGB(255, 30 ,100,100)
    PanelComanda.Tag = Newuid
    PanelComanda.Width = ScrollViewComanda.Panel.Width
    
    GD.SetOnGestureListener(PanelComanda, "Gesture")
    
    ScrollViewComanda.Panel.AddView(PanelComanda,0dip, i * 90dip, ScrollViewComanda.Panel.Width, 80dip)

Next
......
Sub Gesture_onDrag(deltaX As Float, deltaY As Float, MotionEvent As Object)
'here I get information about the swipe, but not about the Swiped panel
End Sub
 
Upvote 0
Top