Android Lollipop Set Status Bar Text Color

android status bar text color oreo
status bar black text
android change status bar icon color programmatically
change status bar color android programmatically
status bar icon color android
change status bar color android xml
white status bar android
dark text in status bar android

I'm trying to set the status bar text color in Android v21, but I'm not seeing an API method for it. Here's what I have so far for the background

MyActivity.java > onCreate:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

        window.setStatusBarColor(getResources().getColor(R.color.white));

    }

Obviously white text on white background won't work. I'm looking for something like

window.setStatusBarTextColor(getResources().getColor(R.color.orange));

For Android 6.0 and above You can check Sunita's answer.

Android 5.0

we are able to change only status bar color not status bar text color.

there is no method like

setStatusBarTextColor(getResources().getColor(R.color.orange));

In short, it's not possible on Android 5.0. Check this answer

Change status bar text color when primaryDark is white, when android:windowLightStatusBar is set to true, status bar text color will be able to be seen when the status bar color is white, and vice-versa  By default, it’s set to Lollipop, which is what you’re seeing above. However, I’m a big fan of the flat theme, which looks like this: It automatically matches the status bar to the exact same color as the action bar (that’s what Google calls the solid color bar at the top of most apps).

Android: Change status bar text color - IMStudio, when android:windowLightStatusBar is set to true, status bar text color will be able to be seen when the status bar color is white, and vice-versa  It is fairly simple to do and works on Android Lollipop and above. Please take a note that: Android 5.0 Lollipop introduced Material Design theme which automatically colors the status bar based on the ColorPrimaryDark value of the theme. There are two ways of changing the StatusBar color, First one using Themes and second one Programatically. We will go through both these methods one by one.

Here's a Java implementation of Gandalf458's answer.

/** Changes the System Bar Theme. */
@RequiresApi(api = Build.VERSION_CODES.M)
public static final void setSystemBarTheme(final Activity pActivity, final boolean pIsDark) {
    // Fetch the current flags.
    final int lFlags = pActivity.getWindow().getDecorView().getSystemUiVisibility();
    // Update the SystemUiVisibility dependening on whether we want a Light or Dark theme.
    pActivity.getWindow().getDecorView().setSystemUiVisibility(pIsDark ? (lFlags & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) : (lFlags | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR));
}

Support for lollipop devices while using windowLightStatusBar, Android API 23 brought with it ability to make status bar icons dark by bar icons in lollipop devices was to manually set status bar color for API  You can not set the status bar text color by specifying any color explicitly But you can try below alternative which is Added in API 23, You can use "android:windowLightStatusBar" attribute in two ways

You can also do this at runtime. Here is an example for Mono.Android using the flag SystemUiVisibility. You have to do some bitwise operations to change the flag. Your application must be set to target API 23 or higher to compile with this flag.

//Android 6.0 introduced the ability to set a light colored text on the status bar
//MyActivity needs to be changed to your activity

if(Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.M)
{
    int newUiVisibility = (int)MyActivity.Window.DecorView.SystemUiVisibility;

    if(state == StatusBarState.Light)
    {
        //Dark Text to show up on your light status bar
        newUiVisibility |= (int)Android.Views.SystemUiFlags.LightStatusBar;
    }
    else if(state == StatusBarState.Dark)
    {
        //Light Text to show up on your dark status bar
        newUiVisibility &= ~(int)Android.Views.SystemUiFlags.LightStatusBar;
    }

    MyActivity.Window.DecorView.SystemUiVisibility = (Android.Views.StatusBarVisibility)newUiVisibility;
}

public enum StatusBarState
{
    Light,
    Dark
}

Android Lollipop Set Status Bar Text Color, I'm trying to set the status bar text color in Android v21, but I'm not seeing an API method for it. Here's what I have so far for the background MyActivity.java  textColorPrimary – The color of UI text in the app bar. statusBarColor – The color of the status bar. navigationBarColor – The color of the navigation bar. These screen areas are labeled in the following diagram: By default, statusBarColor is set to the value of colorPrimaryDark.

FOR ANDROID 6.0+

You can use this to change the status bar content color to light on black background, as shown in below image.

View decorView = this.getWindow().getDecorView();
int systemUiVisibilityFlags = decorView.getSystemUiVisibility();
systemUiVisibilityFlags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
decorView.setSystemUiVisibility(systemUiVisibilityFlags);

By default, it is black so leave it for the light background.

how to change the status bar text color in android?, You can not set the status bar text color by specifying any color explicitly. But you can try to use "android:windowLightStatusBar" which is Added in API 23, You can find more details here: Lollipop) { var window = ((Activity)_context).Window  Xamarin forms: Customize Android Material style status bar color. I have enabled Material theme on my Xamarin.Forms project with the following code, but on Android (Lollipop and Marshmallow) the top status bar (where the clock, signal, battery, etc.. are located) doesn't change. It remains always black.

Change StatusBar Color in Android Lollipop and Above, Lets see how to set StatusBar color using themes. if you are using AppCompat Theme, In file res/values/style.xml, make the following changes:  Set status bar color for DrawerLayout StatusBarUtil . setColorForDrawerLayout( Activity activity, DrawerLayout drawerLayout, int color) Set translucent status bar for using ImageView as head view page

Solved: Is there any way to change the text color in Statu, Solved: Hi I've created an App for IOS and Android that uses statusbar plugin for changing the status bar color. Using it on ios I can set a background color  With Android Nougat, Google incorporated a new feature: the ability to not only change font size, but also other display elements. Essentially, this means everything from the navigation bar to app icons and menus can be made bigger or smaller—think of it like changing the zoom level in Microsoft Windows.

Setting Android Status Bar Background & Icon Colors, Setting Android Status Bar Background & Icon Colors. Over the past Modern apps will set the status bar to match the background color when toggling between light and dark. Since we Lollipop) return; var activity = Plugin. I am currently using the Material with my application, however I would like to change the status bar color dynamically in OnCreate I know this can be achieved in Android Studio using window.setStatusBarColor(Color.BLUE);, not sure how to accomplish this in Xamarin Studio.

Comments
  • i don't think,there no method like setStatusBarTextColor in Android 5.0
  • Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on Stack Overflow. See "Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?.
  • Changing Lollipop status bar text color is not possible. Either you set the status bar background to be translucent which results in #4000 background guaranteeing sufficent legibility or you set it manually to some color (hint: primary dark, keyword dark) which will guarantee enough contrast with the white foreground. We can now manually change the color from black or whatever random drawable Samsung was using, isn't that enough?
  • It is possible from API 23 and above, check the answer below by Sunita
  • Amazing. didn't know that. Works like a charm.
  • In case anyone else is just a 'maintainer' of an Android app like me; just drop this in your styles.xml under the theme section your app or view is using: <item name="android:windowLightStatusBar">true</item>
  • Working fine for me.
  • Thank you for this answer