1
votes

I want to change the Blank screen background colour based on app theme for eg. if app theme is in light mode then it should come with white background. and if app theme is dark theme then it should come with black background it should not be based on device theme.

Thanks in Advance!!!

1
Does this answers your question stackoverflow.com/a/69386585/11983124Praveen
And you can't change the color of the background, according to the saved preference of the user. you can only set a default color.Praveen

1 Answers

0
votes

In your base application theme, add item android:windowBackground and set it's value to your desired color.

Here's an example

<!-- 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>