Skip to content

[BUG] StatusBar.SetColor Transparent Misbehaves in Edge-to-Edge #3106

Closed

Description

@david-maw

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

The attached one-page sample program initially shows an edge-to-edge page with a transparent status bar. This all seems to work correctly and you see this:

Image

Then tap the button to change the status bar color. On Android 36 here's what you see:

Image

We're still in edge-to-edge but the green background has obscured the top of the page, which is what I'd expect. Then we switch to a transparent
background and see this:

Image

The green status bar area has not gone away, so neither the red background not the text at the top of the page shows. The test program cycles through a couple more colors, but the result is the same.

On Android 34 setting a non-transparent status bar color cancels edge-to-edge until you set a transparent color and then edge to edge is restored., which still seems wrong, but wrong in a different way (in that it cancels, or at least suspends, edge-to-edge)

Expected Behavior

When a transparent status bar background color is restored the top part of the page should become visible again. Whether or not a transparent status bar is set should have no effect on edge-to-edge.

Steps To Reproduce

  1. Open and run the solution from the repository (on Android 36)
  2. Tap the button and observe the behavior.

Link to public reproduction project repository

https://github.com/david-maw/StatusBarTransparent.git

Environment

- .NET MAUI CommunityToolkit:14.0
- OS: Android 34 and 36
- .NET MAUI:10.0.40

Anything else?

I can work around this, so for me it's not especially urgent.

Activity

  1. IgrisModz commented on Mar 5, 2026

    @IgrisModz

    I investigated this issue and found the root cause.

    Problem

    In StatusBar.android.cs (line 49-61), the overlay is created but never assigned a tag:

    var statusBarOverlay = decorGroup.FindViewWithTag(statusBarOverlayTag); // Always returns null!
    
    if (statusBarOverlay is null)
    {
        statusBarOverlay = new(Activity)
        {
            LayoutParameters = new FrameLayout.LayoutParams(...)
            {
                Gravity = GravityFlags.Top
            }
        };
        // ❌ Missing: statusBarOverlay.Tag = statusBarOverlayTag;
        decorGroup.AddView(statusBarOverlay);
    }

    Since statusBarOverlay.Tag is never set, FindViewWithTag("StatusBarOverlay") always returns null, causing a new overlay to be stacked on top every time StatusBar.SetColor() is called.
    This explains the behavior in your reproduction: the green overlay is never removed/updated, it just gets a new overlay stacked on top of it.

    Comparison with NavigationBar

    NavigationBar.android.cs (line 109) correctly sets the tag:

    navigationBarOverlay.Tag = navigationBarOverlayTag; // ✅ Correct

    Fix

    Add one line after creating the StatusBar overlay:

    statusBarOverlay.Tag = statusBarOverlayTag;

    Workaround

    Until this is fixed, you can find all StatusBar overlays by their layout characteristics (Gravity.Top + height = status_bar_height + 3) instead of using FindViewWithTag.
    I implemented this workaround for my fullscreen service: FullscreenService.cs

  2. locked and limited conversation to collaborators on Mar 25, 2026
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions