material-components / material-components/material-components-android
[CoordinatorLayout] Keep the state of a view using HideViewOnScrollBehavior on configuration change.
@imhappi is already working on this.
Since Feb 26, 2025.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
When a view is hidden using HideViewOnScrollBehavior and there is a configuration change (e.g. screen rotation) the view is shown again, I'm not sure if this is intended behavior (this also happened with now deprecated HideBottomViewOnScrollBehavior).
Describe the solution you'd like
It would be better if the view kept its hidden state when a configuration change occurs.
Additional context
I attached a video where the navigation bar reappears when the screen is rotated.
Using Pixel 9 emulator API 35. Material version: 1.13.0-alpha10
Also, the action bar is misplaced when rotating the device, looks like it's still applying the display cutout insets even though the cutout is no longer above the bar. I attached a screenshot showing the problem
Sample repo: HideBottomViewSample.zip
https://github.com/user-attachments/assets/2f74298c-d077-4ae1-97c6-be29726b5b18
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.