Get navigation bar background color (real value)

Viewed 14

I'd like to colorize a view at the bottom of my Activity with the exact same color as the system navigation bar. How can I achive that? Especially in case that the navigation bar color is transparent but the system enforced a contrast...

val navigationColor = activity.window.navigationBarColor
val enforceContrast = activity.window.isNavigationBarContrastEnforced

val realColor = if (enforceContrast) {
    // TODO:
    // find out how the system calculates the enforced background color...
} else navigationColor 

On my device I do see a semi transparent navigation bar even though the navigationBarColor is fully transparent (forcefully set by myself in my theme), I'd like to know how I can get the finally used color.

0 Answers
Related