Search code examples
androidkotlinstatusbar

Is it possible to change status bar icon color to white? Or is there a dark theme status bar? (Kotlin)


In my app, I've changed the background color of the status bar to black with : window.statusBarColor = ContextCompat.getColor(this@MainActivity, R.color.black) (And it works). But now, you can't see the status bar icons! And yes, I've heard of: window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, but that sets the background (of the status bar) to white and the status bar icons to grey. Is there a way to make the status bar icons white, whilst still having a black background? Or is there a dark theme for the status bar?


Solution

  • In your theme, set windowLightStatusBar to false -- and you can also set your status bar color in the theme:

    <item name="android:statusBarColor">@color/black</item>
    <item name="android:windowLightStatusBar">false</item>