TimesSquare Calendar view for Android
TimesSquare: a Calendar view for iOS and Android
Hello i am talking about how to integrate timesqaure calendar view today.There are few steps in order to integrate it in your project.
- Download library from this link .
- Include library in your project.
-
Usage :
IncludeCalendarPickerView
in your layout XML.<com.squareup.timessquare.CalendarPickerView android:id="@+id/calendar_view" android:layout_width="match_parent" android:layout_height="match_parent" />
This is a fairly large control so it is wise to give it ample space in your layout. On small devices it is recommended to use a dialog, full-screen fragment, or dedicated activity. On larger devices like tablets, displaying full-screen is not recommended. A fragment occupying part of the layout or a dialog is a better choice.In theonCreate
of your activity/dialog or theonCreateView
of your fragment, initialize the view with a range of valid dates as well as the currently selected date.Calendar nextYear = Calendar.getInstance(); nextYear.add(Calendar.YEAR, 1); CalendarPickerView calendar = (CalendarPickerView) findViewById(R.id.calendar_view); calendar.init(new Date(), new Date(), nextYear.getTime());
To retrieve the currently selected date, callgetSelectedDate()
on the view.
Pros:
- This is very good option if you want to select single date and return to your activity.
- Very smooth scrolling.
- You can modify theme of calendar by changing colors in color.xml in library project.
- <color name="calendar_active_month_bg">#1fc7fd</color>
<color name="calendar_bg">#555555</color>
<color name="calendar_divider">#fcc31f</color>
<color name="calendar_inactive_month_bg">#6ddbfd</color>
<color name="calendar_selected_day_bg">#555555</color>
<color name="calendar_text_inactive">#fd7246</color>
<color name="calendar_text_active">#fd7246</color>
<color name="calendar_text_selected">#fd7246</color>
<color name="calendar_text_unselectable">#fd7246</color> - <color name="calendar_active_month_bg">#014156</color>
<color name="calendar_bg">#ffffffff</color>
<color name="calendar_divider">#555555</color>
<color name="calendar_inactive_month_bg">#027da3</color>
<color name="calendar_selected_day_bg">#039aca</color>
<color name="calendar_text_inactive">#ffffff</color>
<color name="calendar_text_active">#FC541F</color>
<color name="calendar_text_selected">#ffffff</color>
<color name="calendar_text_unselectable">#c4c4c4</color>
![]() |
![]() |
1 | 2 |
Cons:
- It provides only one method getSelectedDate(). You can't get more information like selected cell position to do more with date cell.
- You can't get multi selection like you can't select all dates between first selected date to second selected date.
- You can't add symbol to notify special dates or can't add event symbol like birthdate.i.e
This library show only 5 rows in a month, for June 2013 it is not showing the 30th June 2013 in calendar. How can i add one more row at the bottom of this month so it it can display 30th June 2013 too. Please reply ASAP...
ReplyDeletethanks man, do you have any idea to add a popup menu when a cell is selected ?
ReplyDelete