Skip to content

[Android] NavigationBar overlaps with StatusBar when mixing HasNavigationBar=true/false in TabbedPage on Android 15 (API 35) #33340

@muak

Description

@muak

Description

When using a TabbedPage with multiple NavigationPage children where some tabs have NavigationPage.HasNavigationBar="false" and others have NavigationPage.HasNavigationBar="true", the NavigationBar on the true tab overlaps with the StatusBar on initial display (Android 15, API 35).

The issue occurs when:

  1. The tab with HasNavigationBar="true" is not the initially selected tab
  2. User switches to that tab for the first time after app launch

The NavigationBar renders correctly after:

  • Switching to another tab and back
  • Navigating to another page and back

Steps to Reproduce

  1. Create a TabbedPage with 4 NavigationPage children
  2. Set HasNavigationBar="false" on Tab 1-3
  3. Set HasNavigationBar="true" on Tab 4
  4. Set Tab 1 as the initial CurrentPage
  5. Run on Android 15 (API 35) device
  6. Switch to Tab 4

Expected Behavior

The NavigationBar on Tab 4 should be positioned below the StatusBar with proper spacing.

Actual Behavior

The NavigationBar overlaps with the StatusBar. The content appears to render behind/under the StatusBar area.

Environment

  • .NET MAUI 10.0.x
  • Android 15 (API 35)
  • Device: Physical device

Reproduction Code

App.xaml.cs

using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;
using Platform = Microsoft.Maui.Controls.PlatformConfiguration;
using TabbedPage = Microsoft.Maui.Controls.TabbedPage;

namespace SampleApp;

public partial class App : Application
{
    public App()
    {
        InitializeComponent();
    }

    protected override Window CreateWindow(IActivationState? activationState)
    {
        var tabbedPage = CreateTabbedPage();
        return new Window(tabbedPage);
    }

    private TabbedPage CreateTabbedPage()
    {
        var tabbedPage = new TabbedPage();
        tabbedPage.On<Platform.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);

        // Tab1-3: NavigationBar=false
        var page1 = new ContentPage { Title = "Page1", Content = new Label { Text = "Page 1" } };
        NavigationPage.SetHasNavigationBar(page1, false);
        tabbedPage.Children.Add(new NavigationPage(page1) { Title = "Tab1" });

        var page2 = new ContentPage { Title = "Page2", Content = new Label { Text = "Page 2" } };
        NavigationPage.SetHasNavigationBar(page2, false);
        tabbedPage.Children.Add(new NavigationPage(page2) { Title = "Tab2" });

        var page3 = new ContentPage { Title = "Page3", Content = new Label { Text = "Page 3" } };
        NavigationPage.SetHasNavigationBar(page3, false);
        tabbedPage.Children.Add(new NavigationPage(page3) { Title = "Tab3" });

        // Tab4: NavigationBar=true (this tab has the issue)
        var page4 = new ContentPage { Title = "Page4", Content = new Label { Text = "Page 4 with NavigationBar" } };
        NavigationPage.SetHasNavigationBar(page4, true);
        tabbedPage.Children.Add(new NavigationPage(page4) { Title = "Tab4" });

        tabbedPage.CurrentPage = tabbedPage.Children[0];
        return tabbedPage;
    }
}

Related Issues

Additional Context

This issue appeared after upgrading to MAUI 10 / .NET 10. It did not occur in MAUI 9 / .NET 9.

The problem seems related to how inactive tabs initialize their NavigationBar/Toolbar when HasNavigationBar settings are mixed within a TabbedPage.

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions