How do you display a 2 digit NumberPicker in android?
numberPicker.setMaxValue(10); numberPicker.setMinValue(0); numberPicker.setFormatter(new NumberPicker.Formatter() { @Override public String format(int i) { return String.format("%02d", i); } });
This will do the trick!
Implement a custom NumberPicker.Formatter that implements your value display padding and call setFormatter.
NumberPicker monthPicker = (NumberPicker) view.findViewById(R.id.np_month); monthPicker.setMinValue(1); monthPicker.setMaxValue(12); monthPicker.setFormatter(new NumberPicker.Formatter() { @Override public String format(int i) { return String.format("%02d", i); } });