Skip to content

[AppBarLayout] "scroll" layout flag problematic on Android 17 QPR1 and QPR2 (autoscrolls when it should not) #5100

Description

@bubbleguuum

Observed on v1.14.0 on a Google Pixel Pro running QPR2 Beta 4. Also happens in the emulator running Android 17 API 37.1 and 37.2

See this issue report on the Android beta tracker (post 7) for more details and a video showing the issue in my app.

The problem is that a MaterialToolBar child of an AppBarLayout with app:layout_scrollFlags="scroll" (possibly combined with other flags but only scroll is important), always auto-scrolls when a BottomNavigationView (see video) that uses fragments within a ViewPager2 for its tabs, switches tabs (ViewPager#setCurrentItem).
It results in unwanted scrolling of the MaterialToolBar when switching tabs This issue does not happen on regular Android 17 and below. It started to happen in an early Android 17 QPR beta version a few months ago.

It is hugely annoying and the only work-around I found for now is to disable "scroll" on the MaterialToolBar if the app is running on Android 17 QPR:

if(Misc.isAndroid17_1_OrLater()) {
            ((AppBarLayout.LayoutParams) _toolbar.getLayoutParams()).setScrollFlags(0);
        }

Normally, the MaterialToolBar scrolls up (hides) when use scrolls the content, but this workaround disable it.

Mind you, the YouTube app is also affected (the issue report linked above was initially for the YT app).

Would be awesome if it could be looked into.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions