Android Horizontal Calendar is an Android library to display of full calendar ( especially to take exact appointement ). It supports custom styling.
- Month Swiper
- Week Swiper
- Hour Picker
- Using the library? Just send me an email.
- Import the library into your project.
-
Grab via gradle
compile 'com.github.HedyHidouRy:HorizontalCalendar:1.00'repositories { ... maven { url 'https://jitpack.io' } }
-
Add WeekView in your xml layout.
<com.hedyhidoury.calendar.horizontallibrary.HorizontalCalendarView android:id="@+id/horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" app:selectedBgColor="#89cacf" app:todaysDateBgColor="#89cacf" app:calendarBgColor="@android:color/white" app:daysTextColor="@android:color/black" app:weekTypeFace="museosans.otf" app:headerPreviousIcon="@drawable/ic_backward" app:headerForwardIcon="@drawable/ic_forward" app:weekForwardIcon="@drawable/ic_forward" app:weekPreviousIcon="@drawable/ic_backward" app:hoursTypeFace="MuseoSans_500.otf" app:headerTypeFace="MuseoSans_700.otf" />
-
Write the following code in your java file to make those options.
// Set hours range, hours format are with this format horizontalCalendarView.setHoursRange("10h30","17h00"); // Set invalidate days of the week horizontalCalendarView.setInvalidatedDays(HorizontalCalendarView.THURSDAY,HorizontalCalendarView.FRIDAY); // Set DatePickedListener horizontalCalendarView.setDatePickedListener(new OnDatePickedListener() { @Override public void OnDatePicked(Date datePicked) { Toast.makeText(MainActivity.this,datePicked.toString(),Toast.LENGTH_SHORT).show(); } });
-
Implement
OnDatePickedListeneraccording to your need.
You can customize the look of the WeekView in xml. Use the following attributes in xml. All these attributes also have getters and setters to enable you to change the style dynamically.
nbOfMonthsdaysTextSizedaysTextColorcalendarBgColordaysBackgroundColorweekTextSizeweekTextColorweekBackgroundColorselectedBgColortodaysDateBgColorweekTypeFaceheaderTypeFaceheaderForwardIconweekForwardIconheaderPreviousIconweekPreviousIconhoursTypeFace
There is also a sample app to get you started.
- Make calendar more smooth
- Adding new features
