Android - NumberPicker 選單顯示格式

Android -  NumberPicker 選單顯示格式

NumberPicker npYear = (NumberPicker) findViewById(R.id.npYear);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    npYear.setFormatter(new NumberPicker.Formatter() {
        @Override
        public String format(int value) {
            int year = value-1911;
            return String.valueOf(year);
        }
    });
}