Hello,
If you need to remove the underline and change the background color at the same time, just replace Transparent with the color you need.
Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("NoUnderline", (h, v) =>
{
h.PlatformView.BackgroundTintList =
Android.Content.Res.ColorStateList.ValueOf(Colors.Red.ToAndroid());
});
For one specific page, I need it transparent. For the rest, I need it Red. How would I implement this?
To achieve this requirement, you need to write this method in the construction method of the corresponding page, not in the CreateMauiApp method.
For example, you have two pages, one called MainPage and one called NewPage1. You need to make MainPage transparent and set the background color to red in NewPage1.
MainPage.cs:
public MainPage(){
InitializeComponent();
Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("NoUnderline", (h, v) =>{ h.PlatformView.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(Colors.Transparent.ToAndroid());
}
NewPage1.cs:
csharp
public NewPage1(){
InitializeComponent();
Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("NoUnderline", (h, v) =>{ h.PlatformView.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(Colors.Red.ToAndroid());
}
Best Regards, Alec Liu.
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][1] to enable e-mail notifications if you want to receive the related email notification for this thread.