首先加入依赖:
implementation 'com.feezu.liuli:timeselector:1.1.3+'
直接用
1 TimeSelector timeSelector = new TimeSelector(view.getContext(), new TimeSelector.ResultHandler() { 2 @Override 3 public void handle(String time) { 4 Log.d("TEST",time); 5 } 6 },"2019-01-01 00:00","2019-12-31 00:00"); 7 //显示小时分钟 8 timeSelector.setMode(TimeSelector.MODE.YMDHM); 9 //不实现小时分钟选择器 10 timeSelector.disScrollUnit(TimeSelector.SCROLLTYPE.HOUR,TimeSelector.SCROLLTYPE.MINUTE); 11 //dialog弹出 12 timeSelector.show();