Android Question AsViewPager in top of another AsViewPager

EduardoElias

Well-Known Member
Licensed User
Longtime User
I have a ASViewPager that is the main control in my app, I change pages with it

There is on my first page another AsViewPager on the botton where I want to show small cards that the user can select

However when the user swipe this card ASViewPager what happens is that he MAIN ASViewPager gets swapped and this is not the behavior I am looking for.

If possible I could lock the main ASViewPager to not intercept swipe, but could not find how.

How can i solve this?
 

Alexander Stolte

Expert
Licensed User
Longtime User
ASViewPager1 is the view below what you want to scroll and at "TouchBegin" you simply deactivate ASViewPager2 and reactivate it as soon as the "TouchEnd" event is triggered.
B4X:
Private Sub ASViewPager1_TouchBegin
    ASViewPager2.Scroll = False
End Sub

Private Sub ASViewPager1_TouchEnd
    ASViewPager2.Scroll = True
End Sub
 
Upvote 0

EduardoElias

Well-Known Member
Licensed User
Longtime User
ASViewPager1 is the view below what you want to scroll and at "TouchBegin" you simply deactivate ASViewPager2 and reactivate it as soon as the "TouchEnd" event is triggered.
B4X:
Private Sub ASViewPager1_TouchBegin
    ASViewPager2.Scroll = False
End Sub

Private Sub ASViewPager1_TouchEnd
    ASViewPager2.Scroll = True
End Sub

I have tried this with no sucess, if you would not mind here is a better explanation:

1629209131513.png


EVERYTHING is a layout loaded in ASViewPagerMain, that I use to change based on the buttons on the bottom

on the first page (index 0) there is on top of the google maps another ASViewViewPager that is only on the botton part where I insert many layouts and have the carousel to change between these cards.

THE PROBLEM:

- first google maps is acting strange, it does let you drag it, however seems like something it taking some of the events

- I have turned off the carousel effect from the ASViewPagerMain, I dont want the user swapping the map and the viewer changing pages

- the smal ASViewPager on the botton NEVER get triggered, I cant swipe, no even then touchbegin and touchend is working.

I am working with the B4XPagesManager

Everything is loaded in many layers:

On the PagesManager:
1629212557295.png


on the first page of the ASViewPagerMain
1629212620488.png


and in the ASViewPagerPlaces
1629212706264.png


Any help appreciatted.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
- first google maps is acting strange, it does let you drag it, however seems like something it taking some of the events
i would recommend to set the property "scroll = False" on the page with the google map, then the map should work again
 
Upvote 0

EduardoElias

Well-Known Member
Licensed User
Longtime User
i would recommend to set the property "scroll = False" on the page with the google map, then the map should work again
Many thanks for you reply !

You mean the B4XPage ? I Could not find a scroll property

The Mapfragment is inserted on a ASViewPager, this one is loaded on the B4XPage
 
Upvote 0
Top