change android datetime picker color react native
i want to share how i can change theme color of the picker.
in android/app/src/main/res/values/styles.xml i put:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:datePickerDialogTheme">@style/DialogDatePicker.Theme</item>
</style>
<style name="DialogDatePicker.Theme" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">@color/ocean_green</item>
<item name="android:textColor">@color/dove_gray</item>
<item name="android:textColorPrimary">@color/dove_gray</item>
</style>
* colorAccent is the color of header of picker and selector
* textColor is the color of numbers and text buttons
* textColorPrimary is the color of text of month.
I hope it works for you, regards.
Tip for the those using the time picker and would like to change the colors.
Change android:datePickerDialogTheme to android:timePickerDialogTheme
(======================need more help visit the blow linhk========================)
https://hashnode.com/post/step-by-step-guide-on-how-to-change-background-and-text-color-of-android-date-time-picker-in-react-native-ckacitc6j02lvb6s1u01uyzzl
3
2
In android/app/src/main/res/values/styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:textColor">#000000</item>
<!-- Add your date time picker here. -->
<item name="android:datePickerDialogTheme">@style/Dialog.Theme</item>
</style>
<!-- Add Date time picker dialog theme here. -->
<style name="Dialog.Theme" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#f3ca1b</item>
<item name="android:textColorPrimary">#000000</item>
</style>
</resources>
Thank you!
2
0
Are there any code examples left?
New code examples in category Javascript
-
Javascript 2023-04-21 22:52:36
-
Javascript 2022-03-27 22:25:20 javascript download string as file
-
Javascript 2022-03-27 21:40:22 sort numbers in array javascript
-
Javascript 2022-03-27 21:20:04 compare two arrays and return the difference javascript
-
Javascript 2022-03-27 21:15:02 javascript regex french phone number
-
Javascript 2022-03-27 21:05:03 cypress custom error message
-
Javascript 2022-03-27 21:00:05 create element javascript with id
-
Javascript 2022-03-27 20:40:57 feather icons react
-
Javascript 2022-03-27 20:20:01 how to make graphql request in axios
-
Javascript 2022-03-27 20:15:07 bootstrap validator password and confirm password