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

BottomSheetBehavior header disappears when calling setState()

Open
#1,692 2 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

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

Description

See attached sample project. It's pretty self-explanatory. Bug confirmed in version `1.2.0` (running Android 10).

When the header of the BottomSheetBehavior is scrolled out of view, and you then call `setState(STATE_HALF_EXPANDED)` (e.g. from a button/timer or whatever) the header will disappear.

I believe `STATE_EXPANDED` and `STATE_COLLAPSED` will show a similar issue. Is there a workaround? A missing `requestLayout()` somewhere?

[BottomSheetBug.zip](https://github.com/material-components/material-components-android/files/5187904/BottomSheetBug.zip)

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.