简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM