Android. Calendarview...show Only One Month Calendar At A Time
i am using CalendarView in which i want to view only one month calendar at a time and view next month on scroll but CalendarView shows all the month at a time. below is my code. &
Solution 1:
to be frank I didn't find any specific method to do the same.. But you can do it other way round by setting the layout Height to roughly 200dp to 300dp.
<CalendarView
android:layout_width="match_parent"
android:layout_height="250dp"
android:id="@+id/calendarView"
android:layout_gravity="right"
/>
and if you want to limit your calendar to present date here is the code
CalendarView calendarview;
calendarView = (CalendarView)findViewById(R.id.calendarView);
long a = calendarView.getDate();
calendarView.setMaxDate(a);
Solution 2:
//getmonthandget how many days incurrentmonth
Calendar calendar = Calendar.getInstance();
int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
cal.setMaxDate(daysInMonth);
Post a Comment for "Android. Calendarview...show Only One Month Calendar At A Time"