Skip to content

wrong statusbar height when Android device has a notch #35103

Description

@fabionapodano

Description

i have tried with:

  • .NET SDK 10.0.200, 10.0.201 and 10.0.203
  • MAUI workload 10.0.20 and a previous 10.0.* version i can't remeber
  • MAUI controls 10.0.41 and 10.0.51

problem is that a blank gap is rendered starting from about the middle of the notch. here it is an example from a Pixel 6 Pro, but the issue is also present on Motorola G85:

Image

while, on devices where the notch is not present (example: Pixel 7, Samsung S24+), everything is rendeded correctly with the exact same code:

Image

I have tried everything I (and ChatGPT, Claude Haiku, Gemini Pro and Copilot) could think of:

  • adding a SafeAreaBehavior
  • rendering statusbar by myself
  • adding a negative padding top the navigation bar which is positioned below the status bar
  • tried several themes

nothing worked. for example, adding a negative padding shiftes the navbar up as expected, but the gap is rendered over the navbar:

Image

this issue has been probably introduced by MAUI 10, as i did not experience the issue when i was using .NET 9. I was forced to upgrade .NET SDK to 10 in order to use iOS 26 SDK.

please note that on iOS devices this issue is not present, regardless of the presence of a notch on the screen

Steps to Reproduce

I don't have any special step to reproduce the issue: I should put here the whole app code..

My main page is pretty standard:

<views:DigiContentPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:MyProject.Controls"
xmlns:viewmodels="clr-namespace:MyProject.ViewModels"
xmlns:views="clr-namespace:MyProject.Views"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="MyProject.Views.HomeGridPage"
x:DataType="viewmodels:HomeGridViewModel"
x:Name="HomeGridPageContext"
BackgroundImageSource="{DynamicResource PageBackground}"
Shell.NavBarIsVisible="False"
Shell.NavBarHasShadow="False">

<ContentPage.Resources>
    <ResourceDictionary>
        <toolkit:InvertedBoolConverter x:Key="InvertedBoolConverter" />
    </ResourceDictionary>
</ContentPage.Resources>

<Grid RowDefinitions="Auto, *">

    <VerticalStackLayout Grid.Row="0" Margin="0">
        <controls:DigiNavBar HideBack="True" />
        <controls:Header ImageUrl="{DynamicResource Header1}"/>
    </VerticalStackLayout>

... and so on

Link to public reproduction project repository

No response

Version with bug

10.0.20

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

.NET 8 (Please specify exact version)

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    repro:device-onlyReproduces only on a physical device; not reproducible on simulator/emulatort/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions