ShawnLin013 / NumberPicker

:slot_machine: The android library that provides a simple and customizable NumberPicker.
MIT License
1.07k stars 240 forks source link

Text align #161

Closed gaminn closed 4 years ago

gaminn commented 4 years ago

HI, I have a vertical NumberPicker with numbers going from 0 to 59. I want all numbers to be aligned right.

I use:

            <com.shawnlin.numberpicker.NumberPicker
                android:id="@+id/picker_min"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                app:np_width="96dp"
                app:np_height="270dp"
                app:np_textSize="40dp"
                app:np_selectedTextSize="43dp"
                app:np_dividerThickness="0dp"
                app:np_dividerColor="@color/colorText"
                app:np_max="59"
                app:np_min="0"
                app:np_selectedTextColor="@color/colorText"
                app:np_textColor="@color/colorText"
                app:np_wheelItemCount="3"
                app:np_value="3"
                app:np_textAlign="textAlignRight"
                app:np_selectedTextAlign="selectedTextAlignRight"
                android:layout_marginRight="15dp"
                app:np_maxFlingVelocityCoefficient="2" />

The numbers are aligned right but numbers higher or equal 10 are partially hidden. I just want to have a nuber picker with numbers aligned like this:

_8 _9 10 11

(please imagine space instead of the underscore - this page removes any spaces)

How to acomplish that?

ShawnLin013 commented 4 years ago

Use the string format %2d