Is StatusBar Color not Changing on Android Emulators?

I’ve been trying to change StatusBar color in my Xamarin Forms app. I can run the app only on the emulators, dont have an android device.

Is StatusBar color change not reflected within the emulators? Ive been trying to simulate the change with APIs 24+. I’ve tried a lot of solutions from the answers here on this page including changing the color directly in the styles.xml, none of them worked.

I’ve noticed that android has some really weird quirks when trying to change some colors; however, I’m starting to think that in this case it could be an issue with the emulators themselves.

Anybody has any experience with that? Thank you.

Answer

Have you tried calling the below method inside your OnCreate() method of MainActivity class, it is working for me.

SetStatusBarColor(Android.Graphics.Color.Red);

After that if you want to call it from your shared code project you could make a dependency service.


Tested with:

  • Xamarin.Forms 5.0.0-pre2
  • Target Android 10.0 API 29
  • Emulator 30.1.5
    Android 9.0 API 28