Stop circular scrolling of Date Picker

匆匆过客 提交于 2019-12-11 14:56:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!