So I'm trying to make a working NumberPicker that wraps together, but when the NumberPicker contains three values or less it doesn't wrap. Also scrolling is super choppy / barely possible with three values. Is there a workaround for this?
My NumberPicker will sometimes contain less than three values and sometimes more than three values and I want it to be wrapped all the time unless it only contains one item.
Here's my code in onCreateView:
View view = inflater.inflate(R.layout.bottomsheet_fragment, container, false);
NumberPicker picker = view.findViewById(R.id.mPicker);
picker.setWrapSelectorWheel(true);
picker.setDisplayedValues(null);
String[] values = {"Test1", "Test2", "Test3"};
picker.setMinValue(0);
picker.setMaxValue(values.length - 1);
picker.setDisplayedValues(values);
picker.setValue(0);
View view = inflater.inflate(R.layout.bottomsheet, container, false);
NumberPicker picker = view.findViewById(R.id.mPicker);
picker.setWrapSelectorWheel(true);
picker.setDisplayedValues(null);
String[] values = {"Test1", "Test2", "Test3"};
/*When using the values array below, the wrapping works as intended*/
//String[] values = {"Test1", "Test2", "Test3", "Test4"};
picker.setMinValue(0);
picker.setMaxValue(values.length - 1);
picker.setDisplayedValues(values);
picker.setValue(0);```