导航栏覆盖颜色

时间:2018-08-16 08:11:44

标签: android android-styles navigationbar

所以我有一个应用程序,所有屏幕均已满。实际上,即使在用户点击时,状态栏和导航栏也被隐藏。现在的问题是,隐藏时导航栏的位置有一个黑色层。

Screenshot

我的风格就是这样

<style name = "NoActionBar" parent = "@android:style/Theme.NoTitleBar.Fullscreen">
    <item name = "android:windowActionBar">false</item>
    <item name = "android:windowNoTitle">true</item>
</style>

onWindowFocusChanged我正在使用这些设置SystemUiVisibility

int uiOptions =
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    findViewById(R.id.rl_main).setSystemUiVisibility(uiOptions);

这是我的.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:id="@+id/rl_main">
<WebView
    android:id="@+id/webView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
</RelativeLayout>

我尝试过:

  

android:fitsSystemWindows =“ true”

<style name="NoActionBar" parent="@android:style/Theme.NoTitleBar.Fullscreen">
    <item name="android:windowActionBar">false</item>
    <item name="android:windowNoTitle">true</item>
    <item name="actionModeBackground">@android:color/black</item>
    <item name="android:windowDrawsSystemBarBackgrounds">false</item>
    <item name="android:windowTranslucentNavigation">false</item>
    <item name="android:windowActionModeOverlay">false</item>
</style>

没有任何效果。任何帮助,将不胜感激。 TIA

1 个答案:

答案 0 :(得分:0)

这是您全屏显示活动的方式

编辑您的styles.xml

<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">#00ffffff</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>
<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
<item name="android:windowFullscreen">true</item>
相关问题