0

Currently I have the following layout in my Activity:

<CoordinatorLayout>
    <AppBarLayout>
        <Toolbar 
            layout_scrollFlags="scroll|enterAlways|snap">
    <NestedScrollView>
        layout_behavior="@string/appbar_scrolling_view_behavior">
        <RelativeLayout>
            <ProgressBar/>
            <FrameLayout
                id=fragment-container>

and this for my Fragment:

<LinearLayout>
    <CardView
        layout_scrollFlags="scroll|enterAlways|snap">
    <RecyclerView>

When scrolling my recyclerView, the toolbar moves following the scroll flags defined in the xml, but the cardview doesn't. How to implement the same behavior to the cardview?

João Carlos
  • 1,405
  • 1
  • 15
  • 21
  • I think your answer might be found [here](https://stackoverflow.com/a/38042481 "here"), if you want to scroll inside the Cardview. Resume of linked post : Although google emphatically recommends avoiding making a card scrollable because it could cause two sets of scroll bars to be displayed (see this [page](https://material.google.com/components/cards.html#cards-behavior "page") ) A solution would be to wrap the contents of your card with a ScrollView. See [this page](https://developer.android.com/reference/android/widget/ScrollView.html "this page") for reference. – Séverin Rubio Nov 27 '17 at 13:12
  • it's not scroll inside the CardView, what i'm looking for is when the recycler view below is scrolled, the Card above behave like an toolbar, hiding, until the event of scroll on the opposite direction happen. – João Carlos Nov 28 '17 at 10:26

0 Answers0