WAI
Status Update
Comments
al...@android.com <al...@android.com>
ch...@google.com <ch...@google.com> #2
If you need that View to always be visible then it shouldn't be contained within the scrolling view (the one with the scrolling Behavior).
no...@contactspls.com <no...@contactspls.com> #3
I have the following situation:
Activity with this structure
CoordinatorLayout
AppBarLayout
Toolbar
TabLayout
ViewPager - uses AppBarLayout.ScrollingViewBehavior
inside the ViewPager I'm displaying my fragments
one fragment contains simply a RecyclerView
the other fragment has a RecyclerView and a bottom view that should always be visible
since the ticket is marked 'WorkingAsIntended' - how do you suggest we get the desired behavior?
since you wrote that the bottom view should be contained inside the scrolling view I moved the view to the activity - and i make it visible and the anchor of the pager in it's original fragment and gone in the other fragment.
This doesn't work well -
the transition between the tabs doesn't animate properly and also it disappears after changing orientation - and there are other issues with it that might be related to issue -https://code.google.com/p/android/issues/detail?id=175243
also this feels wrong from the design aspect - why would it be in the activity if it is relevant only to one fragment
Activity with this structure
CoordinatorLayout
AppBarLayout
Toolbar
TabLayout
ViewPager - uses AppBarLayout.ScrollingViewBehavior
inside the ViewPager I'm displaying my fragments
one fragment contains simply a RecyclerView
the other fragment has a RecyclerView and a bottom view that should always be visible
since the ticket is marked 'WorkingAsIntended' - how do you suggest we get the desired behavior?
since you wrote that the bottom view should be contained inside the scrolling view I moved the view to the activity - and i make it visible and the anchor of the pager in it's original fragment and gone in the other fragment.
This doesn't work well -
the transition between the tabs doesn't animate properly and also it disappears after changing orientation - and there are other issues with it that might be related to issue -
also this feels wrong from the design aspect - why would it be in the activity if it is relevant only to one fragment
no...@contactspls.com <no...@contactspls.com> #4
ki...@gmail.com <ki...@gmail.com> #5
chrisba...@google.com ,
<FrameLayout (scrolling behavior)>
<RelativeLayout (scrolling behavior)>
<RecyclerView (scrolling behavior)/>
<LinearLayout/>
</RelativeLayout>
</FrameLayout>
In this case LinearLayout should be always visible right? Well it's not.
This is bug. If it's not, then How about a sample how it should be done???
<FrameLayout (scrolling behavior)>
<RelativeLayout (scrolling behavior)>
<RecyclerView (scrolling behavior)/>
<LinearLayout/>
</RelativeLayout>
</FrameLayout>
In this case LinearLayout should be always visible right? Well it's not.
This is bug. If it's not, then How about a sample how it should be done???
ch...@google.com <ch...@google.com> #6
No it's not a bug, it's working as intended.
The fix is simple, don't put your footer within the View which is set with the scrolling behavior.
The fix is simple, don't put your footer within the View which is set with the scrolling behavior.
ki...@gmail.com <ki...@gmail.com> #7
Ohh really? Using Fragments is impossible then. Or you offer me to add some dynamic padding to FrameLayout or ViewPager since android:layout_below="@+id/appBarLayout" dose not work?
va...@gmail.com <va...@gmail.com> #8
Using in Fragments is giving issue as can be seen in the following repo:
https://github.com/varunrramani/HideOnScrollIssue commit id: 2c2da171dee589c5cdc6589f5ec5ae375dc01e48
[Deleted User] <[Deleted User]> #9
If this is not a bug, then ViewPager is useless in this scenario. As I can see, and I came across the same bug, the ViewPager should not use the Scrolling behaviour, but if it doesn't have it, then the CoordinatorLayout simply overlaps it with the tabs or toolbars you put on top.
I tried a setup similar to Kirvis, obtaining the same results :
<CoordinatorLayout>
<Toolbar/Tabs>
<ViewPager (scrolling behavior)>
<RelativeLayout> <----- One of the tabs
<RecyclerView (scrolling behavior)>
<LinearLayout>
I tried a setup similar to Kirvis, obtaining the same results :
<CoordinatorLayout>
<Toolbar/Tabs>
<ViewPager (scrolling behavior)>
<RelativeLayout> <----- One of the tabs
<RecyclerView (scrolling behavior)>
<LinearLayout>
gi...@gmail.com <gi...@gmail.com> #10
I've the same problem...
sw...@gmail.com <sw...@gmail.com> #11
I've the exact same problem!
And yeah this solution is useless in for Fragments, I can't move that Layout from Fragment to ParentActivity, it's not its responsibility.
Please do post if anyone has solution to this apart from hacky one like adding padding/margin to bottom component.
And yeah this solution is useless in for Fragments, I can't move that Layout from Fragment to ParentActivity, it's not its responsibility.
Please do post if anyone has solution to this apart from hacky one like adding padding/margin to bottom component.
no...@contactspls.com <no...@contactspls.com> #12
this is the solution that i found to the issue i originally posted (it does contain changing the padding)- http://stackoverflow.com/a/31140112/2482564
di...@gmail.com <di...@gmail.com> #13
Based on #12's solution, I came up with the following. It works well when scrolling up and down with the finger, but it doesn't work as well when releasing the finger and allowing the app bar to animate open or closed, even though the numbers seem to line up based on logs. In this case, the padding doesn't align the bottom of the viewpager's content exactly with the bottom of the screen. I'm not sure why that is and would be happy for any feedback.
public class CustomScrollingViewBehavior extends AppBarLayout.ScrollingViewBehavior {
public CustomScrollingViewBehavior() {
}
public CustomScrollingViewBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
boolean result = super.onDependentViewChanged(parent, child, dependency);
final int totalScrollRange = ((AppBarLayout) dependency).getTotalScrollRange();
final int bottomPadding = totalScrollRange + dependency.getTop();
child.setPadding(child.getPaddingLeft(),
child.getPaddingTop(),
child.getPaddingRight(),
bottomPadding);
return result;
}
}
public class CustomScrollingViewBehavior extends AppBarLayout.ScrollingViewBehavior {
public CustomScrollingViewBehavior() {
}
public CustomScrollingViewBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
boolean result = super.onDependentViewChanged(parent, child, dependency);
final int totalScrollRange = ((AppBarLayout) dependency).getTotalScrollRange();
final int bottomPadding = totalScrollRange + dependency.getTop();
child.setPadding(child.getPaddingLeft(),
child.getPaddingTop(),
child.getPaddingRight(),
bottomPadding);
return result;
}
}
di...@gmail.com <di...@gmail.com> #14
I found a workaround for #13, not one that I'm entirely happy with but it's doing the trick for me. If there's a better way to do this and still accomplish the goal that the OP and myself are after, I'm all ears.
http://stackoverflow.com/a/33396965/1317564
tr...@gmail.com <tr...@gmail.com> #16
I have created a fix, which basically removes scrolling flags and overrides offsetting scrolling view when scrolling content is within bounds of scrolling view. It works for your footer and also for view pager. https://gist.github.com/MaciejKaras/02bff315f00b87d80467a470424f22c3
da...@gmail.com <da...@gmail.com> #17
I have same issue, only with FAB. My hierarchy is:
<CoordinatorLayout
<AppBarLayout
<Toolbar app:layout_scrollFlags="snap|scroll|enterAlways"
<TabLayout
<FrameLayout app:layout_behavior="@string/appbar_scrolling_view_behavior"
and Frame layout is container for viewpager, which contains fragments, one of which contains recycleview + fab. see attachments.
<CoordinatorLayout
<AppBarLayout
<Toolbar app:layout_scrollFlags="snap|scroll|enterAlways"
<TabLayout
<FrameLayout app:layout_behavior="@string/appbar_scrolling_view_behavior"
and Frame layout is container for viewpager, which contains fragments, one of which contains recycleview + fab. see attachments.
Description
Version used:
com.android.support:design:22.2.0
com.android.support:appcompat-v7:22.2.0
com.android.support:recyclerview-v7:22.2.0
We have an activity with an AppBarLayout, ViewPager containing fragments - each holding a RecyclerView.
The ViewPager is using AppBarLayout.ScrollingViewBehavior.
in fragment A we have a bottom view without any scroll flags - when we scroll the RecyclerView the coordinator layout hides/shows the AppBarLayout as well as our footer.
Expected behavior : the bottom view should be always visible