NumberSlidingPicker icon indicating copy to clipboard operation
NumberSlidingPicker copied to clipboard

How to change font size and arrow color?

Open shahzad1 opened this issue 5 years ago • 4 comments

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

shahzad1 avatar Jul 23 '20 05:07 shahzad1

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"

yasamisd avatar Jul 25 '20 16:07 yasamisd

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 avatar Mar 12 '21 12:03 kewitschka

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

Azarnoyz avatar Mar 15 '21 14:03 Azarnoyz

@Azarnoyz I updated my answer.

kewitschka avatar Mar 15 '21 16:03 kewitschka