Before my app loads I can change the color of the loading screen using
<resources>
<style name="Theme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="android:background">#FF444444</item>
</style>
</resources>
However, if I do this then I can no longer load the material design library's TimePickerView
because it says Binary XML file line #57: Error inflating class com.google.android.material.timepicker.TimePickerView
and, more importantly, Attempted to get ShapeAppearanceModel from a MaterialButton which has an overwritten background.
Once I remove the above android:background
all is well. Except my loading screen is now white.
So, is there a way to change the loading screen colour without the above XML attribute in the hope that I can get material's TimePicker
to work? Or perhaps another work around?
(I've found out how to disable the loading screen completely, but the second or so wait is not ideal.)
Here are the possible solutions (the first solved it):
android:windowBackground
instead of android:background
>> requires to use a resources color than a hardcoded one (i.e. @color/some_color
)window.decorView.setBackgroundColor(some_color)
right after setContentView()
callandroid:colorBackground
& android:windowBackground
to have the same color, and remove android:Background