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

[BottomSheetDialogFragment] Top inset impossible to remove

Open
#3,389 11 comments 2 reactions 0 assignees 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

**Description:** I am currently trying to create a fullscreen/full height `BottomSheetDialogFragment`, but since it has a very weird behavior implemented where it adds and retracts insets while the sheet is sliding in and out, I decided to disable any inset handling done by the component and manually take care of the insets. However, I found a problem with that approach as well. No matter what I try, the component still forces a top inset that is the same size of the status bar even when disabling any and all inset handling flags I could find checked in the component source code, ex.:

https://github.com/material-components/material-components-android/blob/46778db594edc5915987dcd6e737fa7d15414690/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java#L1726-L1734

The objective is for the component screen to fill the entire screen of the device, but as it currently is the top area of the status bar can never be covered, meaning the component will never display underneath the status bar as desired.

**Expected behavior:** Screenshots are attached,
- Screen 1 is meant to launch the component
![screen1 (25%)](https://github.com/material-components/material-components-android/assets/9222661/2d40a050-1d73-4efb-bcdc-6220b8495a76)

- Screen 2 is what is currently happening, notice the top area that cannot be covered
![screen2 (25%)](https://github.com/material-components/material-components-android/assets/9222661/d1cf466d-9103-428d-bc74-2805a24b9484)

- Screen 3 is what it should be looking like at the top (I created a separat activity just to represent how screen 2 should be looking)
![screen3 (25%)](https://github.com/material-components/material-components-android/assets/9222661/183e9f5c-a08c-495a-8017-460a0930338f)

**Source code:** Not applicable.

**Minimal sample app repro:** Sample follows attached.
[BottomSheetInsetBug.zip](https://github.com/material-components/material-components-android/files/11437611/BottomSheetInsetBug.zip)

**Android API version:** Any android version since 24 (7.0 Nougat) till most recent 33 (13.0). Tested all versions and every single one of them have the same issue.

**Material Library version:** Material Android Library version `com.google.android.material:material:1.8.0`

**Device:** Any real device and emulator tested.

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 BottomSheetBehavior.java around lines 1726-1734 and reproduce the issue using the attached BottomSheetInsetBug.zip sample. Check how the documented inset-handling flags affect the top status-bar inset across the reported Android API versions. Done means a fullscreen BottomSheetDialogFragment can cover the status-bar area when inset handling is disabled, without breaking the existing sliding behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.