gpt4 book ai didi

android-10.0 - Android Q Edge to Edge 应用程序内容未显示透明导航栏

转载 作者:行者123 更新时间:2023-12-03 21:02:49 25 4
gpt4 key购买 nike

我遵循了制作 Gestural Navigation 的文档。将应用程序边缘扩展到边缘。但我无法看到导航栏变为透明。

build.gradle 设置,

        compileSdkVersion 'android-Q'
minSdkVersion 21
targetSdkVersion 28

样式值,
<!-- Testing Edge to Edge app content -->
<item name="android:navigationBarColor">@android:color/transparent</item>

<!-- Optional, but recommended for full edge-to-edge rendering -->
<item name="android:statusBarColor">@android:color/transparent</item>

我在 onCreate() 中设置了 UI 可见性标志方法
        //        Adding UI Visibility flag for edge to edge app content
View view = findViewById(R.id.mainView);
// hide navigation
// view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
// layout stable
// view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
// view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
// view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN);
// having two flags hide navigation or layout fullscreen
// view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
// having two flags hide navigation or layout stable
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);

最佳答案

尝试这个:

View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);

关于android-10.0 - Android Q Edge to Edge 应用程序内容未显示透明导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56343787/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com