1

I am trying to customize the colors of the DatePicker using a spinner mode in React-Native on Android. I know this needs to be done in the styles.xml for Android and I have styled a and the calendar form of the DatePicker. I would also like to know how to remove the border and change the font color (example in picture (https://i.stack.imgur.com/yEZMt.jpg)).

I am still fairly new to Android development so I am just a bit lost on how to target the specific things I need.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:spinnerItemStyle">@style/SpinnerItem</item>
    <item name="android:spinnerDropDownItemStyle">@style/SpinnerDropDownItem</item>
    <item name="android:datePickerDialogTheme">@style/Dialog.Theme</item>
</style>

<style name="SpinnerItem" parent="Theme.AppCompat.Light.NoActionBar">>
    <item name="android:textSize">18dp</item>
    <item name="android:textStyle">bold</item>
</style>

<style name="SpinnerDropDownItem" parent="Theme.AppCompat.Light.NoActionBar">>
    <item name="android:textColor">#ffffff</item>
    <item name="android:textSize">18dp</item>
    <item name="android:textStyle">bold</item>
    <item name="android:gravity">center</item>
    <item name="android:background">#E05B35</item>
</style>

<style name="Dialog.Theme" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorAccent">#FF0000</item>
    <item name="android:textColorPrimary">#0000FF</item>
</style>

I want to make the left image look more like the right:

target

I am just looking for the correct Parent to be able to style my DatePicker spinner and possibly a resource which would show me all of the aspects I can target. My problem is lack of knowledge on what I need to target and how Android would label it. It would be awesome if someone knew about an online resource that updated in real time so I wouldn't need to recompile my app every time I make a change. I would appreciate a doc which would explain how to target each element. Thank you.

Jake Lee
  • 7,549
  • 8
  • 45
  • 86
Ryan
  • 105
  • 2
  • 15
  • 1
    Possible duplicate of [Style android spinner](https://stackoverflow.com/questions/13703233/style-android-spinner) – Jake Lee Jan 17 '19 at 15:52
  • Thats close to my problem, I'm just not sure how to access the spinner on the DatePicker. I have styled the normal spinner already. – Ryan Jan 17 '19 at 18:42
  • Sorry I'm not quite understanding. Would you be able to post a full screenshot with the part you can't style highlighted? – Jake Lee Jan 17 '19 at 18:45
  • Maybe this will help to clarify (https://imgur.com/a/dFbwOwZ). I am looking to target the areas I have highlighted on the left to resemble something like I have on the right. I am just unsure of how I can target each of those areas. – Ryan Jan 17 '19 at 19:12
  • Ah, that's a bit more in depth than I can help with, sorry! Good luck in the future. – Jake Lee Jan 17 '19 at 19:25
  • 1
    Thanks for trying, take care! – Ryan Jan 17 '19 at 19:29

0 Answers0