sephiroth74/NumberSlidingPicker

How to change font size and arrow color?

shahzad1 opened this issue · 4 comments

Hi, is there any method to change font size and change arrow color?

Hi, is there any method to change font size and change arrow color?

Define a style in your app styles.xml

<style name="textAccent" parent="NumberPicker.EditTextStyle">
<item name="android:textColor">@color/colorAccent</item>
<item name="android:textSize">18sp</item>
<item name="android:textStyle">bold</item>
</style>

add this attribute to your xml code where you add NumberPicker
app:picker_editTextStyle="@style/textAccent"

How can I change the arrow color?

Update: Found the solution

res/layout/main_activity.xml

    <it.sephiroth.android.library.numberpicker.NumberPicker  
                       android:id="@+id/yearOfBirth"
                        style="@style/NumberPicker.None"
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:progress="2000"
                        app:picker_editTextStyle="@style/numberPickerText"
                        app:picker_max="2020"
                        app:picker_min="1920"
                        app:picker_orientation="vertical"
                        app:picker_stepSize="1"
                        app:picker_tracker="exponential" />

res/values/themes/themes.xml

<resources>
    <style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
        <item name="colorControlNormal">@color/white</item>
    </style>

    <style name="numberPickerText" parent="NumberPicker.EditTextStyle">
        <item name="android:textColor">@color/white</item>
    </style>

</resources>

@kewitschka Can you send full code with xml of view and style? I tried to change arrow color, but can`t

@Azarnoyz I updated my answer.