Search code examples
androidandroid-statusbarandroid-window

Color of status bar icons in Dialog's Window


This is the code which I use for changing color of status bar icon:

window.decorView.systemUiVisibility = if (light) {
    View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
} else {
    View.SYSTEM_UI_FLAG_VISIBLE
}

Unfortunately it does not work for Window object of a Dialog. Any idea why?

EDIT: It is not a duplicate of Android statusbar icons color - the link SO thread doesn't mention Dialogs


Solution

  • The problem was that I was executing this code from DialogFragment.onStart and I should call it from onResume