一个Android Material 日期范围选择器,基于wdullaers MaterialDateTimePicker。 

Credit to the original amazing material date picker library by wdullaer - https://github.com/wdullaer/MaterialDateTimePicker

Date Picker Time Picker

步入正题:日期范围选择器 MaterialDateRangePicker

Update 

-Added Time Range Picker 

Date Selection 

 

Time Selection 

 

Support for Android 4.0 and up. 

From the original library documentation - 

You may also add the library as an Android Library to your project. All the library files live inlibrary. 

Using the Pickers 

  1. Implement anOnDateSetListenerorOnTimeSetListener 
  2. Create a `DatePickerDialogusing the supplied factory 

Implement anOnDateSetListener 

In order to receive the date set in the picker, you will need to implement theOnDateSetListenerinterfaces. Typically this will be theActivityorFragmentthat creates the Pickers. 

or 

Implement anOnTimeSetListener 

In order to receive the time set in the picker, you will need to implement theOnTimeSetListenerinterfaces. Typically this will be theActivityorFragmentthat creates the Pickers. 

//new onDateSet@Overridepublic void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth,int yearEnd, int monthOfYearEnd, int dayOfMonthEnd) {}@Overridepublic void onTimeSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth,int yearEnd, int monthOfYearEnd, int dayOfMonthEnd) {        String hourString = hourOfDay < 10 ? "0"+hourOfDay : ""+hourOfDay;        String minuteString = minute < 10 ? "0"+minute : ""+minute;        String hourStringEnd = hourOfDayEnd < 10 ? "0"+hourOfDayEnd : ""+hourOfDayEnd;        String minuteStringEnd = minuteEnd < 10 ? "0"+minuteEnd : ""+minuteEnd;        String time = "You picked the following time: From - "+hourString+"h"+minuteString+" To - "+hourStringEnd+"h"+minuteStringEnd;        timeTextView.setText(time);}

地址:https://github.com/borax12/MaterialDateRangePicker

更多相关文章

  1. 阅读《Android(安卓)从入门到精通》(13)——日期选择器
  2. 两种方式使用android时间和日期控件
  3. Android(安卓)时间格式转换
  4. Android中获取指定日期是星期几
  5. 世界范围内浏览器市场份额调查,symbian不行了
  6. Android学习笔记(27):日历视图Calendar
  7. Android学习笔记(28):三种选择器DatePicker_TimePicker_NumberPi
  8. Android日期空间(DatePickerDialog)中的年月日不全部显示
  9. 【Google认证】STS:Android(安卓)Security Test Suite

随机推荐

  1. 介绍数据库生成xml的两个简单示例代码
  2. XML模式-FIXML和SVG的区别
  3. 详细介绍Mybatis在Xml中处理大于号和小于
  4. XML模式 -Dublin Core的详细介绍
  5. 简单介绍百度新闻开放协议XML文档制作方
  6. 详细介绍将XML数据转换成HTML的示例代码
  7. 数据中有'<'、'&'符号时,封装的XML就无法
  8. XML基本概念入门介绍
  9. XML入门教程:XSLT-XML/XSLT的代码实例
  10. .net读写xml文档详解