-
Notifications
You must be signed in to change notification settings - Fork 492
Description
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
On Android 35+, multiple StatusBar overlays are stacked on top of each other in the DecorView. A new overlay is created every time StatusBar.SetColor() is called because FindViewWithTag("StatusBarOverlay") always returns null.
This causes:
• Visual artifacts when trying to hide the status bar
• Memory waste from orphaned views
• Fullscreen implementations failing to completely hide the status bar area
Expected Behavior
Only one StatusBar overlay should exist, and its background color should be updated when StatusBar.SetColor() is called (same behavior as NavigationBar).
Steps To Reproduce
- Create a .NET MAUI app targeting Android 35+
- Set different StatusBar.SetColor() values on different pages (e.g., MainPage has one color, SettingsPage has another)
- Navigate between these pages multiple times
- Enter fullscreen mode or inspect the DecorView hierarchy
- Observe multiple StatusBar overlays stacked
Link to public reproduction project repository
https://github.com/IgrisModz/Scan-Manga
Environment
• .NET version: 10
• CommunityToolkit.Maui version: 14.0.1
• Target Android API: 35
• Device: Any Android 35+ device/emulatorAnything else?
Root Cause:
In StatusBar.android.cs (lines ~50-60), the overlay is created but the Tag is never set:
statusBarOverlay = new(Activity)
{
LayoutParameters = new FrameLayout.LayoutParams(...)
{
Gravity = GravityFlags.Top
}
};
// ❌ Missing: statusBarOverlay.Tag = statusBarOverlayTag;
decorGroup.AddView(statusBarOverlay);Meanwhile, NavigationBar.android.cs correctly sets the tag:
navigationBarOverlay.Tag = navigationBarOverlayTag; // ✅Suggested Fix:
Add the missing line after creating the StatusBar overlay:
statusBarOverlay.Tag = statusBarOverlayTag;Workaround:
Until this is fixed, a workaround is to find all StatusBar overlays by their layout characteristics (Gravity.Top, MatchParent width, and height = status_bar_height + 3) instead of using FindViewWithTag.
👉 FullscreenService.cs workaround implementation