question

PardeepSharma-6679 avatar image
0 Votes"
PardeepSharma-6679 asked LeonLu-MSFT edited

Xamarin.Android Dark mode not working for Dialogs and Pickers

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.

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LeonLu-MSFT avatar image
1 Vote"
LeonLu-MSFT answered LeonLu-MSFT edited

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.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks LeonLu, it helped and worked fine.

0 Votes 0 ·
LeonLu-MSFT avatar image LeonLu-MSFT PardeepSharma-6679 ·

I convert this comment to answer.

0 Votes 0 ·