user940016 user940016 - 1 month ago 16x
Android Question

Change the step size of a NumberPicker

Is it possible to do that in a more convenient way than handling it in the OnScrollListener event? Pity it doesn't have a step size attribute...


Why not just add an OnValueChangeListener Something like:

numberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {

     public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
         picker.setValue((newVal < oldVal)?oldVal-5:oldVal+5);