Reputation: 121
How to display more items/numbers in numberpicker while scrolling because its displaying only 3 numbers.Here is my code
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);
Upvotes: 2
Views: 744
Reputation: 1921
I have changed your code please try this it will help
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);
Upvotes: 1