Fragment in CoordinatorLayout does not scroll - android

This is a followup of this question where you can find all source code: Android does not show tabs
Originally I had no fragment, no tabs, just single activity that used NestedScrollView to hold its content and it worked like a charm - appbar was shortened when I scrolled and I was able to scroll the content.
Now I try to introduce tabs and I moved the content into new Fragment. I used ViewPager with layout_behavior attribute in the activity and LinearLayout in a fragment layout. I think that this is similar to CoordinatorExamples. But the content does not scroll at all and appbar is static, it does not changes when I try to scroll.
Where is the problem? The ViewPager must be OK as it works in the sample.

Related

Android - Make StatusBar transparent on a specific fragment in ViewPager

I have a ViewPager with several fragments, his layout includes only the ViewPager with a TabLayout, nothing else.
And one specific fragment (in view pager) which has a coordinator layout with collapsing toolbar (on the right)
What I want to do is to set the StatusBar transparent only on the right fragment. Just imagine I want to move the picture on the right fragment completely top
I've tried several methods like android:fitsSystemWindows="true" , make the ViewPager fullscreen (it wasn't what I expected) or modify application theme. But this is a specific situation that I can't find any solution. Thanks for any ideas.

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)

NestedScrollView not scrolling

Ok so I have a global CoordinatorLayout with the following layout
content_main is a FrameLayout that fragments are transacted into. For this particular fragment I have a requirement of placing a TabLayout at a certain % of screenheight, so I went the route of using a ViewPager (with each fragment containing a NestedScrollView to coordinate with the CoordinatorLayout for proper scrolling behavior -- which all works as expected). However my transacted fragment layout (NestedScrollView) is not scrolling at all, however the layout_behavior is working as the AppBar/ToolBar are reacting to a scroll.
Any help on this would be greatly appreciated.
EDIT: I have created a sample project to show current broken behavior. https://github.com/bmc08gt/NestedScrollView-with-ViewPager The intended behavior is for the tablayout to collapse to the toolbar.

Scrolling viewpager with sticky TabStrip header

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

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