material-components / material-components/material-components-android

[AppBarLayout] appBarLayout cause coordinatorLayout swipe stucks while swipeRefreshLayout is the parent.

Open
#1,802 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Widget: TopAppBar
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:**
For some reason I have to put `coordinatorLayout` inside `swipeRefreshLayout`, it scrolls well if there is no `appBarLayout` inside `coordinatorLayout`, but if I put `appBarLayout` inside `coordinatorLayout`, the swipe down gesture not works as expected.
![bad](https://user-images.githubusercontent.com/12015910/96243343-34041480-0fd7-11eb-8128-2cf845b572e9.gif)

**Expected behavior:**
When appBarLayout removed.
![good](https://user-images.githubusercontent.com/12015910/96243355-38c8c880-0fd7-11eb-88c7-07b22d5b4845.gif)

**Source code:**
```
swipeRefreshLayout {
onRefresh { isRefreshing = false } // just for test
coordinatorLayout {

// appbar start
appBarLayout {
button("appBarLayout") {
padding = dip(32)
}.lparams(matchParent, wrapContent) {
scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
}
}.lparams(matchParent, wrapContent) {
behavior = AppBarLayout.Behavior()
}
//appbar end

recyclerView {
backgroundColor = 0xff66ff66.toInt()
layoutManager = LinearLayoutManager(context)
// adapter = //todo set adapter.
}.lparams(matchParent, wrapContent) {
behavior = AppBarLayout.ScrollingViewBehavior()
}
}
}

```

**Android API version:** Android 11

**Material Library version:** 1.3.0-alpha03

**Device:** Pixel 3a AVD

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided nested SwipeRefreshLayout, CoordinatorLayout, AppBarLayout, and RecyclerView example on Android 11 with Material Library 1.3.0-alpha03. Compare the swipe-down gesture with and without AppBarLayout, and verify that refresh behavior works as expected while the app bar remains present.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.