5

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?

copycat13
  • 179
  • 1
  • 7

1 Answers1

10

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.

copycat13
  • 179
  • 1
  • 7
  • This is the solution to my problem, thank you very much, here are my upvotes to both your question and answer. Do accept this answer as the accepted one as it solves the problem – Some random IT boy Jun 04 '21 at 09:41
  • Instead of setting transparent navigation bar it changed a color of StatusBar. – CoolMind Aug 23 '21 at 09:02
  • 1
    @CoolMind, maybe you confusing something. Code above just disable system content protection on Android 10+ on NavigationBar by this code `false` and it has no effect on StatusBar. Though, there's code which do the same but with StatusBar `false` – copycat13 Aug 26 '21 at 11:44
  • @CoolMind, read more about it [here](https://medium.com/androiddevelopers/gesture-navigation-going-edge-to-edge-812f62e4e83e#:~:text=Disabling%20system%20bar%20protection%20on%20Android%2010) – copycat13 Aug 26 '21 at 11:47