Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Show Only Current Month in android Calendar view

Show Only Current month in Calendar View Android (or) Either Disable the Scroll View in Calendar View .......

Code for Displaying Calendar that i have written

<CalendarView
        android:id="@+id/calendar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:showWeekNumber="false"
       android:shownWeekCount="5" 
       android:scrollbars="none"/>

How Can I Show Only Current Month.....?Please Help Me Guys Thanks In Adcance.

like image 480
user2244658 Avatar asked May 10 '13 11:05

user2244658


1 Answers

Whithin your class you can show all the way up to the end of the current month with:

//get month and get how many days in current month
Calendar calendar = Calendar.getInstance();
int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
cal.setMaxDate(daysInMonth); 

I don't beleive your android:scrollbars="none" is doing anything for you.

You could also try something like this one .

like image 64
jcaruso Avatar answered Oct 20 '22 20:10

jcaruso