java - 隐藏导航时沉浸式模式留下略透明的白条
问题描述
进入全屏沉浸模式时,导航栏所在的部分较亮
这是我的 XML 布局文件:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.QuoteActivity">
<TextView
android:id="@+id/quote"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:fontFamily="@font/din_light"
android:gravity="center_horizontal"
android:text=""Quote""
android:textColor="#FFFFFF"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/quote_author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="@font/din_light"
android:gravity="center_horizontal"
android:text="- Author"
android:textColor="#FFFFFF"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/quote" />
</androidx.constraintlayout.widget.ConstraintLayout>
这些是我用来进入沉浸式模式的标志:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quote);
this.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| 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);
}
这是我的styles.xml:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@drawable/bg_2880x1440</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:background">@drawable/ls_2880x1440</item>
</style>
</resources>
我没有 android:fitsSystemWindows="true"
在我的程序中使用任何地方。
白色条带不是我背景的一部分。
当我截图它时,它就消失了(图像是它在应用程序中的样子)
这也发生在顶部,但不太明显。
所以我的问题是,我该如何摆脱这个?
解决方案
推荐阅读
- python - tensorflow.keras.dataset.minst.load_data() 返回的解释
- c# - Incorrect UTC time in Calendar File for MS Outlook
- ajax - How can I print_r an array from controller while an ajax process?
- postgresql - 如何在更新时忽略/跳过重复(索引)
- android - Not Encoding URL Parameters with retrofit 返回一个奇怪的响应
- c# - 在 C# 中使用 int 数据类型添加大数的问题
- angular - 如何以角度单独添加用户和管理员导航
- python - 在参数化函数中仅使用一次夹具
- cmake - cmake transitive usage: propagate libs but keep headers private
- java - 更改地图类型时,mapbox.getStyle() 返回 null