android - Android Splash-Screen,底部图像与导航栏重叠
问题描述
我在初始屏幕中添加了一个底部图像,并发现了一个不错的新挑战,因为我现在无法平衡状态栏和导航栏
我的启动画面是由我的启动器活动的主题实现的,当我的活动创建并准备好时,我会加载应用程序主题。
所以我不使用额外的飞溅活动。
样式如下所示:
<style name="splashscreen" parent="android:Theme.NoTitleBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowFullscreen">false</item>
</style>
splash_screen-drawable:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<!-- color of spaces not covered by the image -->
<color android:color="#0f0" />
</item>
<!-- the image in the center of the screen -->
<item android:gravity="center" android:drawable="@mipmap/splash_image"/>
<!-- the image at the bottom-end of the screen-->
<item android:gravity="bottom|end" android:drawable="@mipmap/inspired" android:end="15dp" android:bottom="20dp"/>
</layer-list>
这会产生这样的视图:
这很好,但是屏幕顶部的状态栏是黑色的:-(因为 android:statusBarColor 单独在这里没有效果我必须添加
<item name="android:statusBarColor">#f00</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
但随后我的启动画面不知何故变得“更长”,并被屏幕底部的导航栏重叠:
我发现改变这个视图的唯一参数是
<item name="android:windowTranslucentNavigation">true</item>
但是你甚至无法阅读文本:
所以我希望以与我的启动背景相同的颜色显示状态栏,因为它很漂亮而且全屏不是选项,因为我真的想要带有图标的状态栏可见
我的飞溅应该在导航栏之前结束,所以没有任何东西重叠。
我还尝试了其他基本主题,但 android:Theme.xxx 是唯一没有在底部重叠的(只要我不尝试设置状态栏颜色)
有什么建议或解决方案吗?
正如我在另一个线程中看到的那样,设置 android:windowBackground 或 android:background 是不同的,当我使用 android:background 时,它适用于启动画面,但即使是 toast 也有相同的背景
解决方案
推荐阅读
- c# - How do i make a tree data structure that can hold two differnet generic types for parent and children
- node.js - Uncaught Exception: Error: Cannot find module 'pcsclite'
- laravel - 为什么我得到这个错误 laravel-worker: ERROR (no such group)
- angular - Angular 7 - 从不同组件更改时重新加载/刷新角度材料数据表
- python - 根据特定列的 len() 提取文本行
- ssis - 结果集为多个变量
- azure - pulumi:如果没有给出,查询pulumi堆栈值
- python - 如何使用编码器在 PsychoPy 上呈现 jpg 图像?
- nixos - 如何安装 vscode 的扩展?
- c# - 右对齐 Xamarin 条目