Android下仿IOS的时间选择器、时间控件Time-Selector

地址:[url]https://github.com/mrfluency/Time-Selector[/url]

Time-Selector
控件基于[url=https://github.com/jingchenUSTC/TimePicker]jingchenUSTC/TimePicker[/url]

[img]http://dl2.iteye.com/upload/attachment/0122/1816/04d4bca5-70a1-35f2-860b-ea6452aae9bf.gif[/img]

使用:

Android Studio中直接在 gradle中加入:
compile 'com.feezu.liuli:timeselector:1.0.8+' 


Eclipse下请下载源码(建议尽早迁移至Studio)

构造1:

TimeSelector(Context context, ResultHandler resultHandler, String startDate, String endDate)

参数说明:ResultHandler为选取时间后的回调 startDate,endDate为时间控件的可选起始时间和结束时间。


TimeSelector timeSelector = new TimeSelector(this, new TimeSelector.ResultHandler() {
@Override
public void handle(String time) {

}
}, "2015-11-22 17:34", "2015-12-1 15:20");

构造2:

TimeSelector(Context context, ResultHandler resultHandler, String startDate, String endDate, String workStartTime, String workEndTime)

参数说明:传入workStartTime,workEndTime可选时间为起始时间和结束时间范围内的每日“时:分”的起始和结束时间,如限制可选时间为:朝9晚5。

TimeSelector timeSelector = new TimeSelector(this, new TimeSelector.ResultHandler() {
@Override
public void handle(String time) {
Toast.makeText(getApplicationContext(), time, Toast.LENGTH_LONG).show();
}
}, "2015-10-30 10:34", "2015-12-1 17:34","9:00","17:00");

使用:
timeSelector.show();

你可能感兴趣的:(android基础知识)