3

In the Android version of a Xamarin Visual Studio solution, I can set the background of my Android App StatusBar but I can't find any way to set the font color. Other answers on Stackoverflow don't actually answer how to change the font color.

This is how to change the status bar background color:

<item name="colorPrimaryDark">#000000</item>

How do I change the status bar font color (the color of the text)?

Similar Stackoverflow questions that address the background but haven't yet answered the font color question:

Maybe this link would help, but it didn't seem to for me. However, it includes a picture of an app and says that the property for the background of the StatusBar is colorPrimaryDark.

Meca
  • 149
  • 2
  • 20
  • What do you mean by Status bar, Status bar is top part of android phone where network, battery, notificatoions icons etc.. showing. There is no text. Can you attach screenshot. – R15 Aug 23 '18 at 07:31
  • 1
    Added link to picture. I am referring to the very top part of the phone screen where the time and other icons are displayed. – Meca Aug 23 '18 at 08:23
  • Did you ever find a fix for this Matt? I can see below that CGPA6.4 has said that you shouldn't do it. However I'm using apps on an Android Phone that have managed to do it? I think it's a reasonable idea to be able to change this font color to match an apps design – Matt Ward Jan 25 '19 at 14:58
  • I didn't find a fix – Meca Feb 01 '19 at 12:08
  • Setting true and false on true in the Android project's styles.xml file sets my status bar text colour from grey to white. – Stephen Duffy May 06 '21 at 10:11

1 Answers1

2

Try doing it programmatically. If you are executing app against >=22 API level than it going to work for you

if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
    Window.ClearFlags(WindowManagerFlags.TranslucentStatus);
    Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
    Window.SetStatusBarColor(Android.Graphics.Color.Red);
}

Output screenshot

enter image description here

R15
  • 13,982
  • 14
  • 97
  • 173
  • That's a great example of how to change the background color. People should bookmark that answer. However, I want to know how do I change the color of the icons and the time? – Meca Aug 23 '18 at 09:09
  • In your picture, it shows the battery and the time. Time says 2:16. I want the 2:16 to be black. Do you know how to make it black? – Meca Aug 23 '18 at 09:38
  • We should not change other app icons, Sometimes color would overlap & nothing would be visible. This is not recommended. You supposed to change your apps related stuff. – R15 Aug 23 '18 at 09:41
  • I'm okay with that answer but I wish it wasn't that way. I'm able to make the time and icons black on iOS. On Android, I have a yellow background with white icons and text. Can't read the white. I'll have to come up with an alternative design. thanks. – Meca Aug 23 '18 at 10:02