https://github.com/lopspower/lazydatepicker
LazyDatePicker an alternative to the native Android Date Picker 📅
https://github.com/lopspower/lazydatepicker
android datepicker lazydatepicker
Last synced: 3 months ago
JSON representation
LazyDatePicker an alternative to the native Android Date Picker 📅
- Host: GitHub
- URL: https://github.com/lopspower/lazydatepicker
- Owner: lopspower
- License: apache-2.0
- Created: 2018-07-05T12:37:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-31T15:55:29.000Z (over 4 years ago)
- Last Synced: 2025-03-30T22:10:03.157Z (6 months ago)
- Topics: android, datepicker, lazydatepicker
- Language: Java
- Homepage:
- Size: 571 KB
- Stars: 373
- Watchers: 3
- Forks: 42
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
LazyDatePicker
=================
[](http://developer.android.com/index.html)
[](https://android-arsenal.com/api?level=16)
[](https://search.maven.org/artifact/com.mikhaellopez/lazydatepicker)
[](https://androidweekly.net/issues/issue-317)
[](http://twitter.com/lopezmikhael)This is an Android project to offer an alternative to the native Android Date Picker.
USAGE
-----To make a lazy date picker add LazyDatePicker in your layout XML and add LazyDatePicker library in your project or you can also grab it via Gradle:
```groovy
implementation 'com.mikhaellopez:lazydatepicker:1.1.0'
```XML
-----```xml
```
You must use the following properties in your XML to change your LazyDatePicker.
| Properties | Type | Default |
| ----------------------- | -------------------------| ---------- |
| `app:ldp_text_color` | color | BLACK |
| `app:ldp_hint_color` | color | GRAY |
| `app:ldp_date_format` | mm-dd-yyyy or dd-mm-yyyy | mm-dd-yyyy |
| `app:ldp_show_full_date`| boolean | true |KOTLIN
-----```kotlin
lazyDatePicker.setDateFormat(LazyDatePicker.DateFormat.MM_DD_YYYY)
lazyDatePicker.setMinDate(minDate)
lazyDatePicker.setMaxDate(maxDate)// The date when is selected
lazyDatePicker.setOnDatePickListener { dateSelected ->
//...
}// True or false when date is selected
lazyDatePicker.setOnDateSelectedListener { dateSelected ->
//...
}
```JAVA
-----```java
LazyDatePicker lazyDatePicker = findViewById(R.id.lazyDatePicker);
lazyDatePicker.setDateFormat(LazyDatePicker.DateFormat.MM_DD_YYYY);
lazyDatePicker.setMinDate(minDate);
lazyDatePicker.setMaxDate(maxDate);lazyDatePicker.setOnDatePickListener(new LazyDatePicker.OnDatePickListener() {
@Override
public void onDatePick(Date dateSelected) {
//...
}
});lazyDatePicker.setOnDateSelectedListener(new LazyDatePicker.OnDateSelectedListener() {
@Override
public void onDateSelected(Boolean dateSelected) {
//...
}
});
```[LOCAL DATE](https://github.com/JakeWharton/ThreeTenABP)
-----You can used `LazyLocalDatePicker` instead of `LazyDatePicker` to have all method with `LocalDate` instead of `Date`.
### XML:
```xml
```
### KOTLIN:
```kotlin
lazyLocalDatePicker.setDateFormat(LazyDatePicker.DateFormat.MM_DD_YYYY)
lazyLocalDatePicker.setMinLocalDate(minDate)
lazyLocalDatePicker.setMaxLocalDate(maxDate)// The localdate when is selected
lazyLocalDatePicker.setOnLocalDatePickListener { localDateSelected ->
//...
}// True or false when date is selected
lazyLocalDatePicker.setOnLocalDateSelectedListener { dateSelected ->
//...
}
```OVERRIDE
-----You can override day, month & year if you want like this in your `strings.xml`:
```xml
D
M
Y```
You can also change the design of the picker by changing the dimensions like this in your `dimens.xml`:
```xml
12dp
2.5dp
1dp
6dp```
And to finish you can also completely redefine the layout by keeping the same name `layout_lazy_date_picker.xml` and keep all the ids. You can find the default one here: [**layout_lazy_date_picker.xml**](/lazydatepicker/src/main/res/layout/layout_lazy_date_picker.xml)
SUPPORT ❤️
-----Find this library useful? Support it by joining [**stargazers**](https://github.com/lopspower/LazyDatePicker/stargazers) for this repository ⭐️
And [**follow me**](https://github.com/lopspower?tab=followers) for my next creations 👍LICENCE
-----LazyDatePicker by [Lopez Mikhael](http://mikhaellopez.com/) is licensed under a [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).