You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
Handling window insets to adapt edge-to-edge enforcement of Android 15 requires the Toolbar height to be set as wrap_content since we usually add padding top on it via ViewCompat.setOnApplyWindowInsetsListener. This however is not possible when a Toolbar is inside CollapsingToolbar since setting the Toolbar's height to wrap_content will make its height matching the CollapsingToolbar height based on this previous issue.
Expected behavior: Enable edge-to-edge enforcement when a Toolbar collapsed using CollapsingToolbar.
This is edge-to-edge, it draws the whole content behind system bars despite the Toolbar height here is incorrect and to be fix due to this bug. The below image is for reference and is not using CollapsingToolbar.
Source code:
This code allows the drawing of ImageView behind status bar but when we collapse the Toolbar, it is not edge-to-edge.
This is not edge-to-edge, the content is being cut and not drawn behind system bars.
Attempt 1
What I did so far is to remove fitsSystemWindows=true in AppBarLayout, which resulted to this.
Adding the runtime padding adjustment.
ViewCompat.setOnApplyWindowInsetsListener(root) { _: View, insets: WindowInsetsCompat ->
val barInset = insets.getInsets(WindowInsetsCompat.Type.systemBars())
// Add padding to this view based on status bar inset
toolbar.updatePadding(top = barInset.top)
// Return WindowInsetsCompat.CONSUMED if you don't want the window insets to keep passing down
// to descendant views including all views of Fragment(s) under this Fragment
WindowInsetsCompat.CONSUMED
}
Conclusion 1
Almost but the collapsed Toolbar height is in mess.
Minimal sample app repro: N/A
Android API version: Android 15
Material Library version: 1.12.0
Device: AVD/Emulator
The text was updated successfully, but these errors were encountered:
Description:
Handling window insets to adapt edge-to-edge enforcement of Android 15 requires the Toolbar height to be set as
wrap_content
since we usually add padding top on it viaViewCompat.setOnApplyWindowInsetsListener
. This however is not possible when a Toolbar is inside CollapsingToolbar since setting the Toolbar's height towrap_content
will make its height matching the CollapsingToolbar height based on this previous issue.Expected behavior: Enable edge-to-edge enforcement when a Toolbar collapsed using CollapsingToolbar.
This is edge-to-edge, it draws the whole content behind system bars despite the Toolbar height here is incorrect and to be fix due to this bug. The below image is for reference and is not using CollapsingToolbar.
Source code:
This code allows the drawing of ImageView behind status bar but when we collapse the Toolbar, it is not edge-to-edge.
This is not edge-to-edge, the content is being cut and not drawn behind system bars.
Attempt 1
What I did so far is to remove
fitsSystemWindows=true
in AppBarLayout, which resulted to this.Adding the runtime padding adjustment.
Conclusion 1
Almost but the collapsed Toolbar height is in mess.
Minimal sample app repro: N/A
Android API version: Android 15
Material Library version: 1.12.0
Device: AVD/Emulator
The text was updated successfully, but these errors were encountered: