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

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

Time-Selector控件基于jingchenUSTC/TimePicker

Android下仿IOS的时间选择器、时间控件Time-Selector_第1张图片
40D75C82-A5FA-4C89-A11D-A74E2929102F.png

使用:
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下仿IOS的时间选择器、时间控件Time-Selector)