GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [CollapsingToolbarLayout] collapsed title with gravity mode `enitreSpace` has incorrect bounds when layout is performed during transition · Issue #5094 · material-components/material-components-android

[CollapsingToolbarLayout] collapsed title with gravity mode enitreSpace has incorrect bounds when layout is performed during transition #5094

New issue
Copy link
New issue
Copy link
Open
Open
[CollapsingToolbarLayout] collapsed title with gravity mode enitreSpace has incorrect bounds when layout is performed during transition#5094
Copy link
Labels
bug

Description

@kligarski
kligarski
opened on Jul 24, 2026
Issue body actions

Description:

When CollapsingToolbarLayout with app:collapsedTitleGravityMode="entireSpace" is laid out during transition, collapsed title receives incorrect bounds, resulting in the title being rendered away from the leading edge of the toolbar.

Expected behavior:

Expected Actual
expected.mp4
actual.mp4

Source code:

In CollapsingToolbarLayout.updateCollapsedBounds:953 collapsed bounds for offsets are calculated for COLLAPSED_TITLE_GRAVITY_ENTIRE_SPACE. The comment states: "If the collapsed title gravity should be using the whole collapsing toolbar layout instead of the dummy layout, we should set the collapsed bounds for offsets.". It seems like for parity, DescendantOffsetUtils.getDescendantRect(this, this, tmpRect); has been used to calculate tmpRect as in the regular case (DescendantOffsetUtils.getDescendantRect(this, dummyView, tmpRect); on line 902).

This however results in calculating the position of CollapsingToolbarLayout relative to the entire window as the function traverses up from the view (second argument - this) to the parent (first argument - this) starting from the parent of the second argument (this.getParent()). The view itself will never be its own parent therefore the traversal will be performed up to the window. As getDescendantRect includes all transformations, any translation applied by the transition (e.g. Slide(Gravity.RIGHT)) to the fragment's view will be included in the calculation resulting in the incorrect layout.

Suggested fix is to use tmpRect.set(0, 0, getWidth(), getHeight(); instead.

Minimal sample app repro: https://github.com/kligarski/android-collapsing-toolbar-layout-title-bug

The reproduction app adds a new fragment with CollapsingToolbarLayout with androidx.transition.Slide transition. When first button is used, layout is requested synchronously. When second button is used, requestLayout is delayed by 150 ms, simulating layout performed during transition. This results in collapsed title being laid out incorrectly.

Android API version: API 37

Material Library version: 1.14.0

Device: Pixel 10 Pro API 37 emulator

Happy to open a PR if helpful.

Activity

  1. kligarski
    added
    bug
    on Jul 24, 2026
  2. kligarski
    added a commit that references this issue on Aug 21, 2026

    feat(Android, Stack v5): add support for subtitle and title/subtitle …

    3fbc4d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.