sephiroth74 / NumberSlidingPicker

Android Number Picker with gestures
MIT License
353 stars 56 forks source link

How to change font size and arrow color? #27

Open shahzad1 opened 4 years ago

shahzad1 commented 4 years ago

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

yasamisd commented 4 years ago

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"

kewitschka commented 3 years ago

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>
Azarnoyz commented 3 years ago

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

kewitschka commented 3 years ago

@Azarnoyz I updated my answer.