Questions tagged [android-number-picker]

A widget that enables the user to select a number from a predefined range. There are two flavors of this widget and which one is presented to the user depends on the current theme.

A widget that enables the user to select a number from a predefined range. There are two flavors of this widget and which one is presented to the user depends on the current theme.

  • If the current theme is derived from Theme the widget presents the current value as an editable input field with an increment button above and a decrement button below. Long pressing the buttons allows for a quick change of the current value. Tapping on the input field allows to type in a desired value.
  • If the current theme is derived from Theme_Holo or Theme_Holo_Light the widget presents the current value as an editable input field with a lesser value above and a greater value below. Tapping on the lesser or greater value selects it by animating the number axis up or down to make the chosen value current. Flinging up or down allows for multiple increments or decrements of the current value. Long pressing on the lesser and greater values also allows for a quick change of the current value. Tapping on the current value allows to type in a desired value.

Useful links

99 questions
36
votes
10 answers

Android NumberPicker with Formatter doesn't format on first rendering

I have a NumberPicker that has a formatter that formats the displayed numbers either when the NumberPicker spins or when a value is entered manually. This works fine, but when the NumberPicker is first shown and I initialize it with setValue(0) the…
A. Steenbergen
  • 3,180
  • 3
  • 31
  • 48
23
votes
5 answers

How to decrease padding in NumberPicker

How to decrease padding in NumberPicker I want something like it:
comalex3
  • 2,040
  • 1
  • 21
  • 36
8
votes
0 answers

Change NumberPicker fading edge value or change alpha of top/bottom text

Is there a way to increase the fading edge or change top/bottom text alpha of number picker? I was able to extend NumberPicker class and change alpha of number picker wheel but once I start scrolling alpha gets applied to the center text as well. As…
7
votes
0 answers

Android - NumberPicker scroll / fling faster

How can I make number picker scroll/fling faster? Currently it takes so much effort from going 00 minute to 59 minute. I've tried some example from Slowing speed of Viewpager controller in android and applied opposite of it to number picker, but I…
Alex
  • 881
  • 1
  • 9
  • 21
5
votes
0 answers

Android Custom number picker issue

I am building a library with a NumberPicker and two buttons which controls the Up and Down of the number. I set the min and max to the NumberPicker with setMin, setMax, setValue and after that I set an ordered array in the setDisplayValues…
Mun0n
  • 4,410
  • 4
  • 24
  • 45
3
votes
1 answer

Display more numbers in NumberPicker

I have two issues, first one is removing the divider in the NumberPicker and I'm extending the NumberPicker in Android to solve this issue, like this: import android.content.Context; import android.content.res.Resources; import…
Abdulrahman
  • 251
  • 1
  • 3
  • 11
3
votes
2 answers

Number picker only allowing zero as value

I am making an app that utilizes the numberpicker. What happens is when I try to create the numberpicker and set its attributes, it just simply won't do anything. The only value it allows is zero, and you can't scroll the numbers with it either.…
Jonas M.W.
  • 33
  • 5
3
votes
0 answers

Android number picker set sensitivity for scroll

I am trying to use a time picker in my alarm clock. My current lowest level api is set to 17 so I cant just use the time/date picker and set the style to spinner because this is only available in api 21. I found this…
Nicholas Muir
  • 2,297
  • 5
  • 26
  • 69
3
votes
4 answers

Closed - Setting NumberPicker default value

I am making a number picker dialog having 2 number pickers, years and months. I want to show some default value in these 2 number picker, apart from 0, 0 Code:: final NumberPicker numberPickerYear = (NumberPicker)…
Adarsh Raj
  • 153
  • 3
  • 12
3
votes
0 answers

Typing with keyboard in TimePicker requires pressing "Enter" before "OK", otherwise values discarded

My program shows classic android.app.TimePickerDialog and listens to OnTimeSetListener.onTimeSet() . After migrating from Android 4.3 to 5.1 I noticed that typing minutes using keyboard and pressing "OK" results wrong values passed to onTimeSet()…
3
votes
3 answers

How to customize value for numbers in NumberPicker in android?

I have a number picker for setting a data limit in MB. right now, I have numberPicker, contains numeric values in sequence like [1,2,3,....., 2000 MB]. But I want a numberPicker that should contain numeric values like [100,200,300,....,…
Pravin Kumar
  • 51
  • 1
  • 1
  • 6
2
votes
1 answer

Call requires API level 29 (current min is 21): `android.widget.NumberPicker#setTextColor`

I want to change selected field of text color using setTextColor. But Android Studio gives me this error. What should I do? Min SDK is 21. This is code of my CustomNumberPicker class: import android.annotation.TargetApi import…
MMG
  • 2,962
  • 5
  • 8
  • 35
2
votes
0 answers

NumberPicker freezes app when changing visibility or height while scrolling

I am working on an app and I have a layout with items that when pressed, reveal a NumberPicker below them, like this: I am using the native Android NumberPicker. The NumberPickers start with visibility GONE and their visibility is toggled when…
JoeBruzek
  • 504
  • 4
  • 16
2
votes
4 answers

How to change background color of number picker in android

Code: It is taking black color by default. How can I change that?
user12632429
2
votes
1 answer

Number picker data is not showing correctly android

Hello guys I am facing a problem with number picker. I have some string that needs to be displayed as but on select second option 'menu' with select button and reopen the dialog containing number picker the data is being shown something like…
Anand Kumar Jha
  • 558
  • 7
  • 20
1
2 3 4 5 6 7