Scrolling viewpager with sticky TabStrip header - android

I have an activity layout in which I have a viewpager that contains a couple of fragments. One of the fragment holds a listview (image sample attached).
What I'm trying to do is to scroll the listview and stick the TabStrip to the top of the layout, so when you are scrolling the list, the viewpager's fragment titles are always visible but you can see the entire listview content.
Above the viewpager there are views that needs to scroll up when the listview is scrolling.
Is any way to achieve this?
I've tried with scrollview and placing the viewpager inside it, but it doesn't work because the viewpager doesn't display at all.
Please help!

i've found the solution by using this nice library from github!!!
noties/Scrollable

Related

Scroll Activity Toolbar off screen scrolling Recyclerview in fragment

I have an activity that hosts 2 fragments, I am currently using a coordinator layout in both fragments with appbarlayout and toolbar layout, I have set it up this way to scroll the toolbar off screen with my recyclerview. This has been causing my layout issues as I've posted here So I am looking to change my approach. If I can the activity will host the tool bar/app bar layout in a coordinator layout.
The problem with this approach is that the 2 fragments have recyclerviews with views at the bottom (buttons). So I'm wondering if it's possible to transfer the scroll from the fragment recyclerview by setting the appbehaviour while maintaining the position of the buttons on the bottom?
Any help on this would be appreciated as I've spent days trying to figure out the alternative approach linked above.
Thanks
Yes it's possible, I'm doing this in an activity with a ViewPager, you just need to add
app:layout_behavior="#string/appbar_scrolling_view_behavior"
in the layout that holds the fragments (in my case the viewpager)

Android: ViewPager swipe only on particular View

I have a ViewPager. Inside this ViewPager I have Fragments that have all the same layout. The layout contains a header and a RecyclerView and I want only the header of this layout to be swipeable. So the user may only switch between the fragments inside the viewpager when he is swipping on the header. I have tried a CustomViewPager but it was not working the way I wanted it to.
Does someone have a solution?
My dirty but working solution is to set a custom TouchListener to my header view and every time it detects a fling to the right or left I call setCurrentItem(index, true) with the ViewPager. It is not the optimal solution, but is working for now.

Horizontal Recyclerview inside Viewpager android

I am facing a problem with Recyclerview inside Viewpager fragments.
I have two fragments and both loaded in ViewpagerAdapter. In the second fragment, I have a simple Horizontal Recyclerview. Initially, 1st fragment is loaded in ViewPager and when I swipe right to left on screen it will redirect me to the second fragment.
In the second fragment Recyclerview already loaded. But when I tried to scroll Recyclerview horizontally for more items it is not scrolling it redirects me to the 1st fragment from swipe left to right.
How to allow the user to view more items?
Help me with this problem.
Thanks in advance.
Try to enable Nested Scrolling for recyclerview
after initialising your recyclerview, add this line of code
your_recyclerview.setNestedScrollingEnabled(true);

Scrolling issues of GridView inside Viewpager inside NestedScrollView

I am having a layout in which I am using CoordinatorLayout and NestedScrollView. I am using viewpager with 3 tabs in the nested scrollview. I am using fragments for the tabs and in one of the tab I am having Gridview.
So now, gridview scrolling is working inside that fragment only, I want the scrolling in the whole page.
Can you please help me here.
Thank you so much in advance.

How to go about containing scrollable views within a ScrollView

I wrote a FragmentActivity app with the use of the v4 support library, consisting of a fragment with a layout that contains a listview (list fragment), and a reusable fragment that changes its layout based on the list item selected (detail fragment).
In the layout for large screens, I have a fragment tag for the list fragment and a scrollview as a fragment container for the detail fragment, to allow fragments whose layouts overflow out of the screen.
Originally, for small screens, I used a basic ScrollView as the fragment container. But, since the listview in the list fragment is a scrollable fragment and there cannot be scrollable views in a ScrollView, it couldn't be scrolled; though the other fragments could be scrolled.
So, I changed the ScrollView to a FrameLayout instead, and while fragments with scrollable views can scroll, the fragments that overflowed the screen could not be scrolled.
How would I go about this problem, with the intention of enabling both fragments with scrollable views and overflowing fragments to scroll in a one-panel fragment view?
Thanks in advance
EDIT: I might be able to use ScrollView in the dynamic layouts used by the detail fragment as I see fit, using it where there are no scrollable views, but are there any better solutions?
Ok, I guess this does require the ScrollView to be used only in layouts in which there are no scrollable views.
I stopped using ScrollView as the root element in the fragment activity layout, and I manually used ScrollViews where applicable, and it's working now.
A better way is still welcome and appreciated.

Categories

Resources