I am using CalendarPickerView to select multiple dates from a calendar. I am able to make the calendar but what happening is, I am only able to see one month of the calendar (current month in my case). There are no more months visible. I don't understand the issue. I have tried multiple pieces of code but I still see only one month of the calendar. How do I show to the user all the months of the year range(1 year) that I have provided?
The screenshot:
Layout:
<com.squareup.timessquare.CalendarPickerView
android:id="@+id/calendar_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarStyle="outsideOverlay"
android:clipToPadding="false"
android:background="#FFFFFF"
android:layout_alignParentTop="true"
android:layout_above="@+id/btn_show_dates"/>
Code in OnCreate of Activity:
final CalendarPickerView calendar_view =
findViewById(R.id.calendar_view);
Calendar nextYear = Calendar.getInstance();
nextYear.add(Calendar.YEAR, 1);
Date today = new Date();
calendar_view
.init(today, nextYear.getTime())
.inMode(CalendarPickerView.SelectionMode.MULTIPLE)
.withSelectedDate(today);
I added the layout in a ScrollView also, as I thought, it is some visibility issue, but nothing works.
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.
From its documentation. – Jay