Make the status bar transparent but remain colored navigation bar on Android 13

I have a Cordova application in which I need to make the statusBar transparent and the navigationBar with a specific color.

I have achieved the first thing, but in Android 13 the statusBar is also made transparent and the webview is tucked underneath. To solve this I add a padding so that the navigationBar can be seen in CordovaActivity.java:

WindowCompat.setDecorFitsSystemWindows(window, false);                          ViewCompat.setOnApplyWindowInsetsListener(window.getDecorView(), (v, insets) -> {
                        int marginBottom = insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom;
                        v.setPadding(0, 0, 0, marginBottom);
                        return insets;
                      });

But by doing this I lose the color of the navigationBar…

How can I make the statusBar transparent and the navigationBar a specific color in Android 13?

I have tried to set the color of the navigationBar as follows and adding and removing flags, but it has no effect:

window.setNavigationBarColor(Color.RED);

Leave a Comment