问题
I am writing an application where using Date Picker. Here I set min/max range to scroll, but is there a way to stop circular scrolling since it repeat lower bound once upper bound finish and vice versa.
Any suggestion!
回答1:
There is no trivial solution. You can try use DatePicker.OnDateChangedListener with some static variables and implement logic to check if your date changed through min/max date, and it did, set the last valid date with recycling. It is some strange solution, but I don't know any another. You can play with similar solution or write your custom DatePicker, or extend DatePicker from android api and override some methods that allow recycling, for this you should take a look on DatePicker source code.
回答2:
You can use this method in NumberPicker
dayPicker.setWrapSelectorWheel(false);
来源:https://stackoverflow.com/questions/27635502/stop-circular-scrolling-of-date-picker