user2244658
user2244658

Reputation: 103

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.

Upvotes: 7

Views: 13176

Answers (1)

jcaruso
jcaruso

Reputation: 2504

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 .

Upvotes: 2

Related Questions