全屏窗口背景

  • 本文关键字:背景 窗口 android
  • 更新时间 :
  • 英文 :


我正在寻找窗口背景img来完全填充屏幕,但我也希望内容位于状态栏和导航栏之间(而不是在它们后面(。

尝试1:导致窗口背景可绘制,位于状态栏和导航栏之间,而不是后面

<item name="android:windowLightStatusBar">false</item>
<item name="android:windowBackground">@drawable/loggedout_bg</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:navigationBarColor">@color/logged_out_system_bar_color</item>
<item name="android:statusBarColor">@color/logged_out_system_bar_color</item>

尝试2:导致绘图填充屏幕,但内容位于状态/导航栏后面

<item name="android:windowLightStatusBar">false</item>
<item name="android:windowBackground">@drawable/loggedout_bg</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowTranslucentStatus">true</item>

我在主活动父布局(constraintLayout(中尝试了使用和不使用fitsSystemWindows

所以。。。如何获得全屏背景图像并将应用程序内内容置于系统栏之间?

覆盖窗口管理器布局参数,并将margintop设置为状态栏和页边距底部的高度。它将在导航栏和状态栏之间。

最新更新