【问题标题】:Is there a way to change the blank screen color that comes before Splash screen based on the Apps theme?有没有办法根据应用程序主题更改启动画面之前出现的空白屏幕颜色?
【发布时间】:2021-12-02 00:43:16
【问题描述】:

我想根据应用主题更改空白屏幕背景颜色,例如。如果应用主题处于浅色模式,那么它应该带有白色背景。如果应用主题是深色主题,那么它应该带有黑色背景,它不应该基于设备主题。

提前致谢!!!

【问题讨论】:

标签: android android-layout splash-screen android-theme


【解决方案1】:

在您的基本应用程序主题中,添加项目 android:windowBackground 并将其值设置为您想要的颜色。

这是一个例子

<!-- Base application theme. -->
<style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
    <!-- Other theme customizations -->


    <!-- Add this line and set value to your desired color -->
    <item name="android:windowBackground">@color/colorBlack</item>
</style>

【讨论】:

    猜你喜欢
    • 2020-06-06
    • 2017-05-23
    • 2018-03-17
    • 2013-12-18
    • 2023-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-31
    相关资源
    最近更新 更多