Search code examples
androidandroid-navigation-bar

Navigation bar is not fully transparent in Android 11 (API 30)


As getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); is not working in Android API 30. I tried another code from this tutorial:

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
            getWindow().setNavigationBarColor(Color.TRANSPARENT);
        }

But the navigation bar is not fully transparent (img), like in Google apps. How can I achieve a fully transparent navigation bar?


Solution

  • As it often comes you find a solution by yourself.
    I found the solution in this tutorial.
    You just need to disable auto system content protection by this code <item name="android:enforceNavigationBarContrast">false</item> in your theme.