79610557

Date: 2025-05-07 12:51:05
Score: 3
Natty:
Report link

For anyone who is having the same issue, I was able to find the solution was posted here by Leon Lu. Using the following code in your CreateMauiApp() method will globally change the color of your button ripple effect:

    Microsoft.Maui.Handlers.ButtonHandler.Mapper.AppendToMapping("MyCustomization", (handler, view) =>
        {
#if ANDROID
            if (handler.PlatformView.Background is Android.Graphics.Drawables.RippleDrawable ripple )
            {
                //Sets the ripple color to green
                ripple.SetColor(Android.Content.Res.ColorStateList.ValueOf(Android.Graphics.Color.Green));

                //Hides the ripple effect
                ripple.SetColor(Android.Content.Res.ColorStateList.ValueOf(Android.Graphics.Color.Transparent));
            };
#endif
        });
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): having the same issue
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Bryson