Repository navigation
[Android] Tabs briefly display wrong background color when navigating between flyout items #29883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,6 +141,10 @@ protected virtual void SetAppearance(ShellAppearance appearance) | |
| return; | ||
| } | ||
|
|
||
| if (_bottomView.Background is ColorDrawable background && appearance is IShellAppearanceElement apperanceElement) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could include a comment here? Something like: "Apply background color from appearance, fallback to default if unavailable"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I have added comments now. |
||
| { | ||
| background.Color = apperanceElement.EffectiveTabBarBackgroundColor?.ToPlatform() ?? ShellRenderer.DefaultBottomNavigationViewBackgroundColor.ToPlatform(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The build is failing at this point:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The build issue has been resolved now. |
||
| } | ||
| _appearanceSet = true; | ||
| _appearanceTracker.SetAppearance(_bottomView, appearance); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue16522" | ||
| TabBarBackgroundColor="#0000FF" | ||
| > | ||
| <FlyoutItem Title="Main"> | ||
| <Tab Title="Main"> | ||
| <ShellContent> | ||
| <ContentPage Title="Main"> | ||
| <StackLayout Padding="10"> | ||
| <Label AutomationId="Label" Text="Welcome to the Main Page!" | ||
| FontSize="24" | ||
| HorizontalOptions="Center" /> | ||
| <!-- Add additional UI elements here --> | ||
| </StackLayout> | ||
| </ContentPage> | ||
| </ShellContent> | ||
| </Tab> | ||
|
|
||
| <Tab Title="Settings"> | ||
| <ShellContent> | ||
| <ContentPage Title="Settings"> | ||
| <StackLayout Padding="10"> | ||
| <Label Text="Settings Page" | ||
| FontSize="24" | ||
| HorizontalOptions="Center" /> | ||
| <!-- Additional UI for Settings --> | ||
| </StackLayout> | ||
| </ContentPage> | ||
| </ShellContent> | ||
| </Tab> | ||
| </FlyoutItem> | ||
|
|
||
| <FlyoutItem Title="About"> | ||
| <ShellContent> | ||
| <ContentPage Title="About"> | ||
| <StackLayout Padding="10"> | ||
| <Label Text="About Page" | ||
| FontSize="24" | ||
| HorizontalOptions="Center" /> | ||
| <!-- Additional UI for About --> | ||
| </StackLayout> | ||
| </ContentPage> | ||
| </ShellContent> | ||
| </FlyoutItem> | ||
| </Shell> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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(); | ||
|
|
||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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(); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo error:
appearanceElementThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have modified the code.