Skip to content

Conversation

@kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Jan 5, 2025

Description

Android docs: https://developer.android.com/reference/com/google/android/material/tabs/TabLayout#setTabIconTint(android.content.res.ColorStateList)

Issues Fixed

Fixes #26905

Before After
Screen.Recording.2025-01-05.at.19.53.17.mov
Screen.Recording.2025-01-05.at.19.54.38.mov

@jsuarezruiz what do you think?

@kubaflo kubaflo requested a review from a team as a code owner January 5, 2025 19:11
@kubaflo kubaflo force-pushed the android-top-bar-icon-colors branch from 90bf31b to 3831a77 Compare January 5, 2025 19:22
@jfversluis
Copy link
Member

jfversluis commented Jan 5, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@Tamilarasan-Paranthaman
Copy link
Contributor

@kubaflo, I believe removing SetIconColorFilter is not appropriate, as it could cause issues in certain scenarios involving FontImageSource color.

Recently, I fixed the FontImageSource color issue on the TabbedPage icon. The PR can be found here: [iOS] [Android] Fix for the FontImageSource color is not applied properly to the Tab Icon by Tamilarasan-Paranthaman · Pull Request #26757 · dotnet/maui

For instance, if there are two ContentPage instances as children of a TabbedPage, setting SelectedTabColor to red while applying different FontImageSource colors to each page may not work as expected.

The SetIconColorFilter method handles the Icon.InvalidateSelf call, ensuring that the icon is updated correctly.

@kubaflo
Copy link
Contributor Author

kubaflo commented Jan 6, 2025

Hi @Tamilarasan-Paranthaman this pr actually fixes the issue in your PR. And there's no need for SetIconColorFilter

Screen.Recording.2025-01-06.at.18.09.05.mov

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho
Copy link
Member

rmarinho commented Jan 7, 2025

Can we make sure adding a menu item and disable and enable it with have the correct colors?

@Tamilarasan-Paranthaman
Copy link
Contributor

Hi @Tamilarasan-Paranthaman this pr actually fixes the issue in your PR. And there's no need for SetIconColorFilter

Screen.Recording.2025-01-06.at.18.09.05.mov

@kubaflo, can you please fully utilize my test sample? I have added the SelectedTabColor and UnSelectedTabColor, but no FontImageSource color is specified for the first page. Only the second and third pages have the FontImageSource color defined.

With your fix, the FontImageSource color is not applied to the second and third pages.

undefined

I have handled the FontImageSource color for different scenarios by using combinations of SelectedTabColor, UnSelectedTabColor, and the FontImageSource color in my PR. It works properly.

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@kubaflo kubaflo force-pushed the android-top-bar-icon-colors branch from fe7c67e to 95d99c6 Compare January 10, 2025 17:54
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/rebase

@github-actions github-actions bot force-pushed the android-top-bar-icon-colors branch from 95d99c6 to 8fc9053 Compare March 20, 2025 07:04
@jsuarezruiz
Copy link
Contributor

jsuarezruiz commented Mar 20, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@kubaflo kubaflo force-pushed the android-top-bar-icon-colors branch from 8fc9053 to 6534efc Compare April 28, 2025 22:17
@kubaflo kubaflo self-assigned this Apr 28, 2025
Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kubaflo
Copy link
Contributor Author

kubaflo commented Jul 28, 2025

#26964 (comment)

@PureWeen @Tamilarasan-Paranthaman

The fix specifically targets IconImageSource, as the issue affects only this type of ImageSource. While FontImageSource might also have similar problems, addressing it would likely require a separate solution.

@jfversluis jfversluis added this to the .NET 9 SR11 milestone Aug 7, 2025
@jfversluis
Copy link
Member

@IX-OmkarP can you try the resulting NuGets from this PR so see if this resolves your issue? See the instructions at the very top in the first post of this PR.

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copilot AI review requested due to automatic review settings August 11, 2025 22:14
@kubaflo kubaflo force-pushed the android-top-bar-icon-colors branch from 6534efc to 9ee6e78 Compare August 11, 2025 22:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue with tab icon coloring on Android where the tab layout's global icon tint was interfering with FontImageSource icons that already have their own color applied. The fix ensures that the global tint is only applied when the icon is not a FontImageSource.

  • Adds conditional logic to prevent applying global tab icon tint to FontImageSource icons
  • Preserves existing tint behavior for other icon types

Prevents applying TabIconTint when the tab icon is a FontImageSource, as it manages its own color. This ensures correct icon coloring for font-based icons in TabbedPageManager.
@kubaflo kubaflo force-pushed the android-top-bar-icon-colors branch from 9ee6e78 to a083c3e Compare August 11, 2025 22:17
@IX-OmkarP
Copy link

@IX-OmkarP can you try the resulting NuGets from this PR so see if this resolves your issue? See the instructions at the very top in the first post of this PR.

@jfversluis Thanks for the ping! I will try the NuGets from this PR and report back. I am a bit short on bandwidth right now, so I may need a few days before I can test and update you.

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jfversluis jfversluis changed the base branch from main to inflight/current August 12, 2025 09:25
@jfversluis jfversluis merged commit 427cd7b into dotnet:inflight/current Aug 12, 2025
51 of 129 checks passed
@IX-OmkarP
Copy link

@jfversluis @kubaflo Thank you it is working

github-actions bot pushed a commit that referenced this pull request Aug 15, 2025
* [Android] Top bar item colors - fix

* Avoid tab icon tint for FontImageSource on Android

Prevents applying TabIconTint when the tab icon is a FontImageSource, as it manages its own color. This ensures correct icon coloring for font-based icons in TabbedPageManager.
github-actions bot pushed a commit that referenced this pull request Aug 15, 2025
* [Android] Top bar item colors - fix

* Avoid tab icon tint for FontImageSource on Android

Prevents applying TabIconTint when the tab icon is a FontImageSource, as it manages its own color. This ensures correct icon coloring for font-based icons in TabbedPageManager.
github-actions bot pushed a commit that referenced this pull request Aug 19, 2025
* [Android] Top bar item colors - fix

* Avoid tab icon tint for FontImageSource on Android

Prevents applying TabIconTint when the tab icon is a FontImageSource, as it manages its own color. This ensures correct icon coloring for font-based icons in TabbedPageManager.
github-actions bot pushed a commit that referenced this pull request Aug 22, 2025
* [Android] Top bar item colors - fix

* Avoid tab icon tint for FontImageSource on Android

Prevents applying TabIconTint when the tab icon is a FontImageSource, as it manages its own color. This ensures correct icon coloring for font-based icons in TabbedPageManager.
@github-actions github-actions bot locked and limited conversation to collaborators Sep 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tab Icon Color Changes Temporarily During Horizontal Scrolling Between Tabs

7 participants