I have a ViewPager with 2 tabs containing a Recyclerview. I am using support libraries 22.2.0 (AppCompat, Recycler view ...). Originally mymlpager xml:
<android.support.v4.view.ViewPager android:id="@+id/viewPager" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_width="match_parent" android:layout_height="match_parent" />
I would like to activate / deactivate the scrolling of the application bar based on each tab / recyclerview, and not based on the whole view, i.e. one tab / recyclerview will scroll the application bar and the other tab / recyclerview will not.
This problem is that when I delete
app:layout_behavior="@string/appbar_scrolling_view_behavior"
from the viewpager, by default, layout_behavior is applied to the viewpager, which still activates scrolling the application bar on the / recyclerview tab.
My strategy is to deactivate scrolling of the application bar in the viewpager, perhaps something like this:
<android.support.v4.view.ViewPager android:id="@+id/viewPager" app:layout_behavior="@string/appbar_desactivated_behavior" android:layout_width="match_parent" android:layout_height="match_parent" />
And activate it only on the first tab / recyclerview. Like this:
<android.support.v7.widget.RecyclerView ... android:id="@+id/playlist1_rv" app:layout_behavior="@string/appbar_scrolling_view_behavior" </android.support.v7.widget.RecyclerView>
But I need a class for "@ string / appbar_desactivated_behavior". He exists? Is that not so? Or are you thinking of a different strategy? Thanks in advance.
android android-viewpager android-recyclerview android-coordinatorlayout
u2gilles
source share