Android Question Disable swipe gesture TabstripViewPager

A0_2_A7

Member
Licensed User
Hello good afternoon, I have been trying various methods to disable the swipe movement when entering a page but there is no way I leave an example to see if you can help me.

I have tried this:
B4X:
Sub TabStrip1_PageSelected (Position As Int)
    Log($"Current page: ${Position}"$)
    If Position = 1 Then
        Dim jo As JavaObject = TabStrip1
        jo.GetFieldJO("vp").RunMethod("setOverScrollMode", Array(2)) 'NEVER
    End If
End Sub

But it continues to slide perfectly to change to other pages and I want to disable the movement.
Thank you very much, greetings.
 

Attachments

  • Tabstrip_test.zip
    11.2 KB · Views: 233

mberthe

Member
Licensed User
Longtime User
One solution:
B4X:
sub globals
  .........
  Dim ip As Int ' ip: selected page
  Dim ipagen As Boolean
  .......
end sub

' To block the page n
.......
  ip= n
  ipagen=True
  tabstrip1.scrollto (n,False)
........
  'page n "blocked" while running this part of code
.........  
  ipagen=False

Sub tabstrip1.pageselected (position As Int)
  If ipagen Then
    tabstrip1.scrollto (n,False)
    ip=n
  Else
    ip-position
  End If
End Sub
 
Upvote 0

A0_2_A7

Member
Licensed User
One solution:
B4X:
sub globals
  .........
  Dim ip As Int ' ip: selected page
  Dim ipagen As Boolean
  .......
end sub

' To block the page n
.......
  ip= n
  ipagen=True
  tabstrip1.scrollto (n,False)
........
  'page n "blocked" while running this part of code
......... 
  ipagen=False

Sub tabstrip1.pageselected (position As Int)
  If ipagen Then
    tabstrip1.scrollto (n,False)
    ip=n
  Else
    ip-position
  End If
End Sub
Thank you for the answer but it is not what I am looking for, the page is effectively blocked, but the horizontal scroll movement is still working and that is not useful for me. I want to disable that horizontal movement.
 
Upvote 0
Top