Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 13 additions & 6 deletions src/Core/src/Platform/Android/SearchViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ public static void UpdatePlaceholderColor(this SearchView searchView, ISearchBar
else if (TryGetDefaultStateColor(searchView, AAttribute.TextColorHint, out var color))
{
editText.SetHintTextColor(color);

var searchMagIconImage = searchView.FindViewById<ImageView>(Resource.Id.search_mag_icon);
searchMagIconImage?.Drawable?.SetTint(color);
ApplyDecorColor(searchView, color);
}
}

Copy link

Choose a reason for hiding this comment

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

introduces trailing whitespace - revert.

internal static void UpdateTextColor(this SearchView searchView, ITextStyle entry)
{
if (TryGetDefaultStateColor(searchView, AAttribute.TextColorPrimary, out var color) &&
Expand All @@ -56,11 +54,20 @@ internal static void UpdateTextColor(this SearchView searchView, ITextStyle entr
if (entry.TextColor is null)
editText.SetTextColor(color);

var searchMagIconImage = searchView.FindViewById<ImageView>(Resource.Id.search_mag_icon);
searchMagIconImage?.Drawable?.SetTint(color);
ApplyDecorColor(searchView, color);
}
}

// Tints the magnifier icon and the underline
static void ApplyDecorColor(SearchView searchView, Color color)
Copy link
Contributor

Choose a reason for hiding this comment

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

This changes should change the color (use the TextColor) for the search icon and the underline, right?

Taking a look to tests, seems is not happening:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is actually the correct appearance :) If you compare it with the previous screenshot, you’ll see that after changing the theme, the underline now appears as expected.
Screenshot 2025-10-31 at 00 38 41

Copy link
Contributor

Choose a reason for hiding this comment

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

The best fix would be that the search icon and the underline can be set by the user (via AppThemeBinding) ;)
In my app i use ResourceConstant.Color.searchBarIconDark and ResourceConstant.Color.searchBarIconLight for both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @AlleSchonWeg this still works:
<SearchBar SearchIconColor="{AppThemeBinding Dark=Red,Light=Green}"/>
But this PR solves the issue when this property is not set

Screen.Recording.2025-10-31.at.13.49.06.mov

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @kubaflo
Is this a new API? I don't have SearchIconColor property for SearchBar.
What color are you using for the line? I would prefer to make the line the same color as the icon. Or let the developer choose the line color (best option):
<SearchBar SearchPlateColor="{AppThemeBinding Dark=Red,Light=Green}"/>
Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was added in here: #26759

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, i'm using SR12:

<PackageVersion Include="Microsoft.Maui.Controls" Version="9.0.120" />
<PackageVersion Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.120" />

but no SearchIconColor;
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see what happened here :)
It is in Net10 Preview 2: dotnet/docs-maui#2817

{
var searchMagIconImage = searchView.FindViewById<ImageView>(Resource.Id.search_mag_icon);
searchMagIconImage?.Drawable?.SetTint(color);

var searchPlate = searchView.FindViewById(Resource.Id.search_plate);
searchPlate?.Background?.SetTint(color);
}

public static void UpdateFont(this SearchView searchView, ISearchBar searchBar, IFontManager fontManager, EditText? editText = null)
{
editText ??= searchView.GetFirstChildOfType<EditText>();
Expand Down
Loading