Hello,
Please do not set directly, if you want to set SearchBar's background to remove the underline, you need get the nested LinearLayout
, then set the background to null for nested LinearLayout
Microsoft.Maui.Handlers.SearchBarHandler.Mapper.AppendToMapping("MyCustomizationSearchBar", (handler, view) =>
{
#if ANDROID
Android.Widget.LinearLayout linearLayout = handler.PlatformView.GetChildAt(0) as Android.Widget.LinearLayout;
linearLayout = linearLayout.GetChildAt(2) as Android.Widget.LinearLayout;
linearLayout = linearLayout.GetChildAt(1) as Android.Widget.LinearLayout;
linearLayout.Background = null;
#endif
});
}
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.