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 650b3fabb113..bce19fa18a79 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs @@ -176,7 +176,8 @@ protected virtual BottomSheetDialog CreateMoreBottomSheet(Action maxItems && index > maxItems - 2)) diff --git a/src/Controls/src/Core/Platform/Android/BottomNavigationViewUtils.cs b/src/Controls/src/Core/Platform/Android/BottomNavigationViewUtils.cs index 99188c12c6dc..48edf2a68d05 100644 --- a/src/Controls/src/Core/Platform/Android/BottomNavigationViewUtils.cs +++ b/src/Controls/src/Core/Platform/Android/BottomNavigationViewUtils.cs @@ -27,6 +27,15 @@ public static class BottomNavigationViewUtils { internal const int MoreTabId = 99; + /// + /// Maximum number of items allowed in the bottom navigation bar. + /// Newer versions of the Xamarin.Google.Android.Material package report + /// BottomNavigationView.MaxItemCount as 6, whereas older versions returned 5. + /// Clamped to 5 for consistent behavior regardless of the Material library version. + /// See https://github.com/dotnet/maui/pull/33450 + /// + internal const int MaxBottomNavigationItems = 5; + public static Drawable CreateItemBackgroundDrawable() { var stateList = ColorStateList.ValueOf(Colors.Black.MultiplyAlpha(0.2f).ToPlatform()); @@ -71,6 +80,7 @@ internal static async void SetupMenu( BottomNavigationView bottomView, IMauiContext mauiContext) { + maxBottomItems = Math.Min(maxBottomItems, MaxBottomNavigationItems); Context context = mauiContext.Context; while (items.Count < menu.Size()) @@ -162,7 +172,7 @@ public static BottomSheetDialog CreateMoreBottomSheet( IMauiContext mauiContext, List<(string title, ImageSource icon, bool tabEnabled)> items) { - return CreateMoreBottomSheet(selectCallback, mauiContext, items, 5); + return CreateMoreBottomSheet(selectCallback, mauiContext, items, MaxBottomNavigationItems); } internal static BottomSheetDialog CreateMoreBottomSheet( @@ -171,6 +181,7 @@ internal static BottomSheetDialog CreateMoreBottomSheet( List<(string title, ImageSource icon, bool tabEnabled)> items, int maxItemCount) { + maxItemCount = Math.Min(maxItemCount, MaxBottomNavigationItems); var context = mauiContext.Context; var bottomSheetDialog = new BottomSheetDialog(context); var bottomSheetLayout = new LinearLayout(context); @@ -300,4 +311,4 @@ public static void SetShiftMode(this BottomNavigationView bottomNavigationView, } } } -} +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3TimePicker_InitialState_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3TimePicker_InitialState_VerifyVisualState.png index 2a1523066c5f..6f1c9b92de5f 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3TimePicker_InitialState_VerifyVisualState.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Material3TimePicker_InitialState_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/DynamicFontImageSourceColorShouldApplyOnBottomTabIconOnAndroid.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/DynamicFontImageSourceColorShouldApplyOnBottomTabIconOnAndroid.png index 9c96a7c42be0..59a5509c1888 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/DynamicFontImageSourceColorShouldApplyOnBottomTabIconOnAndroid.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/DynamicFontImageSourceColorShouldApplyOnBottomTabIconOnAndroid.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/DynamicTabSectionVisibility.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/DynamicTabSectionVisibility.png index b606e64cfbee..a050cfa72c10 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/DynamicTabSectionVisibility.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/DynamicTabSectionVisibility.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/FontImageSourceColorShouldApplyOnBottomTabIconOnAndroid.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/FontImageSourceColorShouldApplyOnBottomTabIconOnAndroid.png index 81e71d355dc8..eddba249d96b 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/FontImageSourceColorShouldApplyOnBottomTabIconOnAndroid.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/FontImageSourceColorShouldApplyOnBottomTabIconOnAndroid.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ImageDoesNotDisappearWhenSwitchingTab.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ImageDoesNotDisappearWhenSwitchingTab.png index 4ae7c76f7516..f0d6d6dc4ee8 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ImageDoesNotDisappearWhenSwitchingTab.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ImageDoesNotDisappearWhenSwitchingTab.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue32993TabBarUpdatesCorrectlyInRTLMode.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue32993TabBarUpdatesCorrectlyInRTLMode.png index 2072cf3b9533..88f84ea070a6 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue32993TabBarUpdatesCorrectlyInRTLMode.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue32993TabBarUpdatesCorrectlyInRTLMode.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/NavigationBarLayoutWithMixedHasNavigationBar.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/NavigationBarLayoutWithMixedHasNavigationBar.png index 994163f57526..1f74fe366e7e 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/NavigationBarLayoutWithMixedHasNavigationBar.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/NavigationBarLayoutWithMixedHasNavigationBar.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingBetweenTabs.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingBetweenTabs.png index 807e98023ac2..f80af6b7455d 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingBetweenTabs.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingBetweenTabs.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingShellSectionToTab_1.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingShellSectionToTab_1.png index dceeb5f4bd2b..e6aba00f9ad5 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingShellSectionToTab_1.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingShellSectionToTab_1.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingShellSectionToTab_2.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingShellSectionToTab_2.png index 9d51872e6ade..a393bc28119b 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingShellSectionToTab_2.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShellAppearanceUpdatesWhenChangingShellSectionToTab_2.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShouldHideCustomFlyoutIconWhenNavigatingToPageWithDisabledFlyout.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShouldHideCustomFlyoutIconWhenNavigatingToPageWithDisabledFlyout.png index 5e6f21d51712..8409f3a428aa 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShouldHideCustomFlyoutIconWhenNavigatingToPageWithDisabledFlyout.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ShouldHideCustomFlyoutIconWhenNavigatingToPageWithDisabledFlyout.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/TabBarIconsShouldAutoscaleShell.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/TabBarIconsShouldAutoscaleShell.png index 34b26788b395..7c4b04d90799 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/TabBarIconsShouldAutoscaleShell.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/TabBarIconsShouldAutoscaleShell.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/TabBarShouldBeVisibleOnMacCatalyst.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/TabBarShouldBeVisibleOnMacCatalyst.png index 44b9a42224ad..4d1a68ba7ae0 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/TabBarShouldBeVisibleOnMacCatalyst.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/TabBarShouldBeVisibleOnMacCatalyst.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarBackgroundColorAndForegroundColor.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarBackgroundColorAndForegroundColor.png index d352e721563c..8a8eb894c26b 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarBackgroundColorAndForegroundColor.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarBackgroundColorAndForegroundColor.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarForegroundColor.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarForegroundColor.png index a3919711ba02..c8d301b98537 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarForegroundColor.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarForegroundColor.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarForegroundColorAndUnSelectedColor.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarForegroundColorAndUnSelectedColor.png index f5e079554a42..1051a3fd76d6 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarForegroundColorAndUnSelectedColor.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyShell_TabBarForegroundColorAndUnSelectedColor.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyTabbedPageMenuItemTextColor.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyTabbedPageMenuItemTextColor.png index f5dcfd75714b..555fefb2ec1f 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyTabbedPageMenuItemTextColor.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyTabbedPageMenuItemTextColor.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/VerifyHybridWebViewWithShadow.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/VerifyHybridWebViewWithShadow.png index 31ae043089cb..51277af796ff 100644 Binary files a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/VerifyHybridWebViewWithShadow.png and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/VerifyHybridWebViewWithShadow.png differ