Android Google Map | Two finger scrolling inside tablayout - android

i have a google maps (fragment) inside a tablayout
With the tablayout i use a FragmentStateAdapter.
This allows me to nicly swipe through my tabs but (you can guess is) this swiping is working against me on the google maps fragment.
My idea was to setup 2 fiinger control for the map while the single finger could still service the tab-swiper.
i found this post and the answer of Andrii Omelchenko did give some real good pointers for a solution
However i do not have a scrollview and i cannot find any on...-methods in my ViewPagers2 and/or the FragmentStateAdapter to intercept the touch-events as is done in the scrollview.
Does anybody have an idea as how to handle the issue?

Related

How can I implement this kind of layout

I just want to implement this kind of layout and I have no idea about how this layout is design. I am working on web browser so for showing web tabs I want to implement this.
Also, should I implement tab using fragment and viewPage's FragmentStatePagerAdapter method?
So these tabs can be deleted upon swiping up them.
Edit
If this is achievable using ViewPager then can anyone give me some guide or link to achieve this. I know how to work with fragment but I don't know how I can zoom out of fragment (like when we get out of Chrome's web tabs). How can I implement this zoom_Out_Of_Fragment kind of thing?
Edit 2
After doing some google search, I found that these are actually recyclerView adapter.

ViewPager with no snapping

What I would like to achieve: Have a ViewPager with TabLayout where each Tab contains a new Fragment that has a RecyclerView layout out horizontally and managed by a FragmentPagerAdapter.
What I am struggling with: The default behaviour is that when you get end of the list on one of the tabs, it switches Tabs and snaps (snapping means if you pull over 50% of the viewport, it jumps to either direction). I want it to free-flow and not to snap. Sort of like how it happens in iOS by default.
I got inspired for this setup by the following two CodePath guide:
https://guides.codepath.com/android/google-play-style-tabs-using-tablayout
https://guides.codepath.com/android/ViewPager-with-FragmentPagerAdapter
How should I approach this problem (preferably without any other libraries)?
What I would do is use HorizontalScrollView instead of a ViewPager. The only caveat is that the view pager sends the lifecycle events to fragments as you scroll between them, whereas for HorizontalScrollView you will have to add them initially, and then they will be continuously active unless you manually change that. Also you may have an option to not use the fragments and use simple views depending on what you use the fragments for.
I would definitely not override the touch events for the ViewPager because it does some cleanup when it detects the UP motion, so just swallowing it is not a correct thing to do.

How to display adjacent tabs in ViewPager?

Here is a sample from duolingo app:
I want to implement a similar feature. I can use ViewPager to make swiping tabs. What I can't seem to figure out is how to display the adjacent tabs (part of it) alongside the current tab, which is in the center.
I initially thought of implementing this using horizontal LinearLayout, but I don't know how to make the snapping effect. And it also seemed more reasonable to use something which already provides you with swiping and snapping than try to implement your own.
Using ViewPager also let's me use fragments and memory management is also effective for cases of more than a few tabs.
Any help will be appreciated. Thank You in advance.

alternative to viewpager for android swipe with tabs?

is there anyway to have swiping with tabs without using viewpager and also not doing a bunch of gesture detection? if not could someone post a sample of what's needed with the gesture detection. I'm hoping to get the left swipe gesture and then do a supportFragmentTransaction everytime. I would use viewpager but it's the buggiest thing since ant hills and doesn't work. basically I have 5 tabs with 5 fragments and just want to swipe between them and have tabs and hopefully have it circular so that when I'm on the last tab and swipe right it goes to the first. Thanks for all your help in advance!

ViewPager Automatic Partial Swipe

I have got three pages in my viewpager and by default i have to set the middle one. But for the first time I want to swipe the viewpager a little left and then right to indicate to a user that there are also two more pages, left and right to it. Please guide regarding the automatic partial swipe of viewpager.
Thanks.
please refere this sample code.In this example you will get how to do automatic swipe of viewpager.
https://github.com/JakeWharton/Android-ViewPagerIndicator
before using this library i also have some problem when i use pager.

Categories

Resources