Set your number picker to show leading zeros by applying a formatter to it.
Example is using an anonymous instance, but of course it doesn’t have to.
[java]
myNumberPicker.setFormatter(new NumberPicker.Formatter() {
@Override
public String format(int value) {
return String.format("%02d", value);
}
});
[/java]
For %02d this goes:
- 0 for filling with zeros
- 2 for length of 2
Leave a Reply