material-components / material-components/material-components-android
[AppBarLayout] Enhance setExpanded() to support 'collapsed with minHeight' state
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
When 'minHeight' is set and scrollFlags includes 'enterAlwaysCollapsed',
scroll up shows only minHeight. ('Collapsed' state)
and setExpanded(true) shows full height. ('Expanded' state)
but setExpanded(false) hide appbar completely.('Hidden' state)
so I can't go back to 'Collapsed' state programmatically.
I suggest to support these Hidden/Collapsed/Expanded state.
I tested by modifying BaseBehavior.onLayoutChild(),
- adding PENDING_ACTION_EXPAND_MIN_HEIGHT,
- offset=abl.getDownNestedPreScrollRange() - abl.getUpNestedPreScrollRange()
will do.
I know the name is confusing. but PENDING_ACTION_COLLAPSED is already used for hidden state. :(
If owner agrees this feature and decide interface, I will upload PR.
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.
Research direction
Start with BaseBehavior.onLayoutChild() and the existing AppBarLayout.setExpanded() behavior described in the issue. Trace how enterAlwaysCollapsed, minHeight, and the pending action states represent hidden and expanded modes. The interface for a collapsed-with-minHeight state still needs owner agreement; done means all three states can be selected programmatically without breaking existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100