Xamarin.Android Dark mode not working for Dialogs and Pickers

Pardeep Sharma 21 Reputation points
2022-05-16T04:09:52.273+00:00

We have implemented dark mode in Xamarin.Forms to target Android and iOS. It works fine in iOS but dialogs and pickers don't respect the System Dark mode updates (Android).

I tried inheriting the base style via:

<style name="MainTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
  </style>

OR

 <style name="MainTheme" parent="Theme.AppCompat.Light.DarkActionBar">
  </style>

But none of the above changes are working. Please suggest if it's a bug in Xamarin.Android framework.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,294 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 68,571 Reputation points Microsoft Vendor
    2022-05-17T02:48:40.47+00:00

    Hello,​

    Please update your Xamarin.Forms nugget package to the latest. Then change the parent of <style> to parent="MainTheme.Base" or parent="Theme.AppCompat.DayNight"

    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful