Maui for Android specific code learning

Haviv Elbsz 1,986 Reputation points
2024-06-06T07:19:26.53+00:00

Hello All .

protected override MauiApp CreateMauiApp() {

 // Remove Entry control underline 

Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("NoUnderline", (h, v) => { 

h.PlatformView.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(Colors.Transparent.ToAndroid()); 

}); 

return MauiProgram.CreateMauiApp();

 }  

Please where I can learn the part of the specific android code .

The code that start with Android.Content.Res.ColorStateList.ValueOf(Colors.Transparent.ToAndroid()); Thank you very much .

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,043 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 70,476 Reputation points Microsoft Vendor
    2024-06-06T07:50:08.6633333+00:00

    Hello,

    where I can learn the part of the specific android code . The code that start with Android.Content.Res.ColorStateList.ValueOf(Colors.Transparent.ToAndroid());

    This part code from the native android, you can find ColorStateList from the google document.

    However, this ColorStateList document set different colors for different states in the xml.

    Based on your code, you have single color and single state, you can set Microsoft.Maui.Graphics.Colors and convert color for android platform by ToAndroid().

    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful