[AppBarLayout] AppBarLayout does not collapse/expand when scrolling vertically over horizontal RecyclerView inside vertical RecyclerView
See original GitHub issueDescription: When vertical RecyclerView
has a horizontal RecyclerView
and if user starts scrolling vertically with finger on horizontal RecyclerView
then AppBarLayout
does not move at all. If finger was on other list items then AppBarLayout
does change its state.
The problem is still there with CollapsingToolbarLayout
inside AppBarLayout.
Expected behavior: AppBarLayout should scroll
Source code: I created a test project where you can see the problem. https://github.com/MaratTursynbek/AppBarLayout-bug
Code of CollapsibleToolbar is taken from this article.
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="76dp"
android:theme="@style/AppTheme.AppBarOverlay.Light">
<com.example.notcollapsingappbar.CollapsibleToolbar
android:id="@+id/motion_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="@dimen/actionBarSize"
app:layoutDescription="@xml/scene_header"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:text="Large title"
android:textColor="@android:color/white"
android:textSize="30sp"
app:autoSizeTextType="uniform" />
</com.example.notcollapsingappbar.CollapsibleToolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingBottom="16dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Android API version: All versions from API 21
Material Library version: 1.2.1
Device: OnePlus 5t, Pixel 3, Pixel 3 emulator, Samsung A10
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
AppBarLayout does not collapse/expand when scrolling ...
When vertical RecyclerView has a horizontal RecyclerView and if user starts scrolling vertically with finger on horizontal RecyclerView then ...
Read more >Appbarlayout Does Not Collapse/Expand When ... - ADocLib
Appbarlayout Does Not Collapse/Expand When Scrolling Vertically Over Horizontal Recyclerview Inside Vertical. 1 Introduction 2 Creating a Nested ScrollView ...
Read more >Unable to scroll vertically when touch horizontal recyclerview ...
When I touch the horizontal recyclerview of the item and scroll up/down, I can't scroll vertically (through the outer scrollview).
Read more >How to Create a Collapsing ToolBar and FAB on Scroll with ...
In this article, we are going to create a collapsing Toolbar and Floating action button (FAB) on scroll with RecyclerView.
Read more >Handling Scrolls with CoordinatorLayout - CodePath Cliffnotes
Scroll events in the RecyclerView trigger changes inside views declared within AppBarLayout by using the app:layout_scrollFlags attribute:
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same issue and android:nestedScrollingEnabled=“false” does solve it for the nested recyclerviews. But I have a horizontal ViewPager inside a vertical recyclerView which is giving me this same issue and cann’t be resolved by using android:nestedScrollingEnabled =false.
What is the solution for that?
What’s the solution to this issue? I am having the same problem as PallabJunior, not working with a ViewPager2.