'Change colour of date picker in Android with possibility to have custom Splash screen as well
I am working on a project where I would like to have custom splash screen, however I would also like to have dark styled Android dialogs, that are corresponding to my Android theme selection.
Currently everything seems to be fine, except that my Date picker has background of my splash screen. How to leave Splash screen as it is, but use custom colour as date picker background instead of splash screen image as it currently is? Also for some reason my other dialogs has blue texts in buttons, but date picker is all violet. Why so and how to fix it?
Here is my styles.xml in Android project:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme.Splash" parent="MainTheme.Base">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="colorPrimary">#2196F3</item>
<item name="colorAccent">#1976D2</item>
</style>
</resources>
Currently if I have this: <item name="android:windowBackground">@drawable/splash_screen</item>
-> My date picker background is splash screen image
If I remove <item name="android:windowBackground">@drawable/splash_screen</item>
-> My splash screen has no image and just dark background
My target is to have dark background in date picker and image in splash screen.
Solution 1:[1]
Here is an answer if anybody wondering the same:
<style name="MainTheme" parent="MainTheme.Base">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="colorPrimary">#2196F3</item>
<item name="colorAccent">#1976D2</item>
<item name="android:datePickerDialogTheme">@style/CustomDatePickerDialog</item>
</style>
<style name="CustomDatePickerDialog" parent="ThemeOverlay.AppCompat.Dialog">
<!--header background-->
<item name="colorAccent">#009933</item>
<!--header textcolor-->
<item name="android:textColorPrimaryInverse">#ff9900</item>
<!--body background-->
<item name="android:windowBackground">#000099</item>
<!--selected day-->
<item name="android:colorControlActivated">#ff8000</item>
<!--days of the month-->
<item name="android:textColorPrimary">#ffff00</item>
<!--days of the week-->
<item name="android:textColorSecondary">#ff0066</item>
<!--cancel&ok-->
<item name="android:textColor">#00ffff</item>
</style>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | LG3 |