Skip to content
Android Date Picker Library that provides a calendar as a horizontal timeline
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Added option to disable dates May 8, 2019
datepicker Updated library version May 8, 2019
gradle/wrapper Updated Gradle to 5.1.1 May 8, 2019
screenshots Added Screenshots Apr 21, 2019
.gitignore Initial Commit Apr 21, 2019
LICENSE Create LICENSE Apr 21, 2019
README.md Fixed a Bug May 8, 2019
build.gradle Updated Gradle to 5.1.1 May 8, 2019
gradle.properties Initial Commit Apr 21, 2019
gradlew Initial Commit Apr 21, 2019
gradlew.bat Initial Commit Apr 21, 2019
settings.gradle Initial Commit Apr 21, 2019

README.md

DatePickerTimeline

An android package that provides a Horizontal Date Picker.

Download

DatePicker Logo

Gradle

In your module (app-level) Gradle file (usually app/build.gradle), Add this line inside the dependencies block.

dependencies {
    ...
    implementation 'com.vivekkaushik.datepicker:datePickerTimeline:0.0.3'
}

Usage

Add DatePickerTimeline View to your layout file

<com.vivekkaushik.datepicker.DatePickerTimeline
android:id="@+id/datePickerTimeline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Properties:

You can use the following properties in your XML to change your DatePickerTimeline colors.

  • app:dateTextColor (color) -> default -> Black
  • app:dayTextColor (color) -> default -> Black
  • app:monthTextColor (color) -> default -> Black
  • app:disabledColor (color) -> default -> Grey

JAVA

DatePickerTimeline datePickerTimeline = findViewById(R.id.dateTimeline);
// Set a Start date (Default, 1 Jan 1970)
datePickerTimeline.setInitialDate(2019, 3, 21);
// Set a date Selected Listener
datePickerTimeline.setOnDateSelectedListener(new OnDateSelectedListener() {
    @Override
    public void onDateSelected(int year, int month, int day, int dayOfWeek) {
        // Do Something
    }

    @Override
    public void onDisabledDateSelected(int year, int month, int day, int dayOfWeek, boolean isDisabled) {
        // Do Something
    }
});

// Disable date
Date[] dates = {Calendar.getInstance().getTime()};
datePickerTimeline.deactivateDates(dates);

You can also use the built in methods to change the text color

datePickerTimeline.setDateTextColor(Color.RED);
datePickerTimeline.setDayTextColor(Color.RED);
datePickerTimeline.setMonthTextColor(Color.RED);

LIMITATIONS

  • Text Size currently can't be changed

FIXES

  • This project is using AndroidX artifacts make sure you have migrated your project to androidX.
  • If Preview dosen't show up in android Studio then make sure you have added android recycler view.

Author

You can’t perform that action at this time.