5

I want to change the font size of the picker plus format the picker items. I've followed the instructions in the following link, re-run react-native run-android, but nothing changes.

How to style the standard react-native android picker?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Railton
  • 161
  • 4
  • 11
  • Regarding the font size: iOS can be done: https://stackoverflow.com/questions/39585253/how-to-give-fontsize-to-react-native-android-picker but not Android yet. – Matt Booth Oct 04 '17 at 14:16
  • Possible duplicate of [how to give fontSize to react native android picker?](https://stackoverflow.com/questions/39585253/how-to-give-fontsize-to-react-native-android-picker) – Stephen Rauch Feb 21 '18 at 03:39
  • Possible duplicate of [How to style the standard react-native android picker?](https://stackoverflow.com/questions/38921492/how-to-style-the-standard-react-native-android-picker) – Cœur Feb 21 '18 at 08:00

1 Answers1

1

It can be styled via native android. See this and this.

Add the following code to /res/values/styles.xml

...

<style name="SpinnerItem" parent="Theme.AppCompat.Light.NoActionBar">>
    <item name="android:fontFamily">sans-serif-light</item>
    <item name="android:textSize">18dp</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:fontFamily">sans-serif-light</item>
    <item name="android:gravity">center</item>
    <item name="android:background">@drawable/mydivider</item>
</style>

Create a file at res/drawable/mydivider.xml and add the following code

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#29A1C9" />
    <corners android:radius="0.5dp" />
    <stroke
        android:color="#FFFFFF"
        android:width="0.1dp" />
</shape>
Mohammad Goldast
  • 367
  • 2
  • 4
  • 14