Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-Native picker - change font size

Tags:

react-native

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?

like image 467
Railton Avatar asked Nov 08 '22 20:11

Railton


1 Answers

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>
like image 64
Mohammad Goldast Avatar answered Nov 15 '22 12:11

Mohammad Goldast