diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs index e75fdf86a5ce..ce6442b8410b 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs @@ -13,6 +13,7 @@ using Google.Android.Material.Navigation; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Microsoft.Maui.Controls.Handlers.Compatibility; using Microsoft.Maui.Graphics; using AColor = Android.Graphics.Color; using AView = Android.Views.View; @@ -141,6 +142,11 @@ protected virtual void SetAppearance(ShellAppearance appearance) return; } + // Apply background color from appearance, fallback to default if unavailable + if (_bottomView.Background is ColorDrawable background && appearance is IShellAppearanceElement appearanceElement) + { + background.Color = appearanceElement.EffectiveTabBarBackgroundColor?.ToPlatform() ?? ShellRenderer.DefaultBottomNavigationViewBackgroundColor.ToPlatform(); + } _appearanceSet = true; _appearanceTracker.SetAppearance(_bottomView, appearance); } diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellTabBarBackgroundColor.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellTabBarBackgroundColor.png new file mode 100644 index 000000000000..fa76e26e9169 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellTabBarBackgroundColor.png differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue16522.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue16522.xaml new file mode 100644 index 000000000000..6719b7468fe0 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue16522.xaml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue16522.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue16522.xaml.cs new file mode 100644 index 000000000000..69d890caa760 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue16522.xaml.cs @@ -0,0 +1,12 @@ +namespace Maui.Controls.Sample.Issues +{ + [Issue(IssueTracker.Github, 16522, "[Android] Tabs briefly display wrong background color when navigating between flyout items", PlatformAffected.Android)] + public partial class Issue16522 : Shell + { + public Issue16522() + { + InitializeComponent(); + + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ShellTabBarBackgroundColor.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ShellTabBarBackgroundColor.png new file mode 100644 index 000000000000..932f00beaac6 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ShellTabBarBackgroundColor.png differ diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16522.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16522.cs new file mode 100644 index 000000000000..33719acd131f --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16522.cs @@ -0,0 +1,26 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues +{ + public class Issue16522 : _IssuesUITest + { + public Issue16522(TestDevice device) : base(device) + { + } + + public override string Issue => "[Android] Tabs briefly display wrong background color when navigating between flyout items"; + + [Test] + [Category(UITestCategories.Shell)] + public void ShellTabBarBackgroundColor() + { + App.WaitForElement("Label"); + App.Tap("Settings"); + App.Tap("Main"); + App.WaitForElement("Label"); + VerifyScreenshot(); + } + } +} diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ShellTabBarBackgroundColor.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ShellTabBarBackgroundColor.png new file mode 100644 index 000000000000..e11ce5be7381 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ShellTabBarBackgroundColor.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ShellTabBarBackgroundColor.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ShellTabBarBackgroundColor.png new file mode 100644 index 000000000000..f55a444cbc56 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ShellTabBarBackgroundColor.png differ