如何在滚动时在numberpicker中显示更多项目/数字,因为它只显示3个数字。这是我的代码
NumberPicker starttime = (NumberPicker) findViewById(R.id.timeListview);
starttime.setMaxValue(47);
String[] time = {"12:00 AM", "12:30 AM", "01:00 AM", "01:30 AM", "02:00 AM", "02:30 AM", "03:00 AM","11:00 PM", "11:30 PM"};
starttime.setDisplayedValues(time);
starttime.setWrapSelectorWheel(true);
我已经更改了您的代码,请尝试这将有所帮助
NumberPicker starttime = findViewById(R.id.timeListview);
String[] time = {"12:00 AM", "12:30 AM", "01:00 AM", "01:30 AM", "02:00 AM", "02:30 AM", "03:00 AM","11:00 PM", "11:30 PM"};
starttime.setMinValue(0);
starttime.setMaxValue(time.length-1);
starttime.setDisplayedValues(time);
starttime.setWrapSelectorWheel(true);