Can't Change Android CalendarView to another month

  • Replies:6
  • OpenNot stickiedUnanswered
  • Forum posts: 3

Jun 10, 2016 8:34:39 PM via Website

Android introduced a CalendarView back in in API 11. I've implemented it in my app and it seems to work fine in the sense that it displays a perfectly normal-looking whole-month calendar and I can select a date and it triggers the appropriate event and I can read the selected date in my code with no problem.

imagescreen shot of my CalendarView

But I can't advance it out of the current month! The documentation says

*A user can select a date by taping on it and can scroll and fling the calendar to a desired date.*

(the "taping" appears in the documentation; I assume it's a typo for "tapping" )

I've tried flinging, swiping, scrolling and nothing happens. Is there something I need to do to enable this feature?

My XML looks like this:

android:layout_height="240dp" />

How can I scroll or fling to other dates, as the documentation says? Thanks in advance.

  • Forum posts: 256

Jun 10, 2016 9:12:51 PM via Website

Try to add these strings to XML:

android:minDate="*your min date in mm/dd/yyyy format*"
android:maxDate="*your max date in mm/dd/yyyy format*"
  • Forum posts: 3

Jun 10, 2016 10:10:26 PM via Website

That was a good idea but it didn't work. I used these but it made no difference . . .


  • Forum posts: 256

Jun 11, 2016 7:51:24 AM via Website

Try to set other background color, maybe arrows which are used to change month have black color abd you can't see them.

  • Forum posts: 3

Jun 13, 2016 5:34:49 PM via Website

We're talking about the native, Android CalendarView class - what makes you think it has arrows? As the documentation says, you change dates by swiping or flinging.

  • Forum posts: 256

Jun 13, 2016 10:31:17 PM via Website

Ok :)

This works on my Android 4.4 and I can scroll the months up/down:

import android.os.Bundle;
import android.widget.CalendarView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

public void onCreate(Bundle savedInstanceState) {

    CalendarView calendarView = (CalendarView) findViewById(;
    calendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {

        public void onSelectedDayChange(CalendarView view, int year,
                                        int month, int dayOfMonth) {
            int mYear = year;
            int mMonth = month;
            int mDay = dayOfMonth;
            String selectedDate = new StringBuilder().append(mMonth + 1)
                    .append(" ").toString();
            Toast.makeText(getApplicationContext(), selectedDate, Toast.LENGTH_LONG).show();



<LinearLayout xmlns:android=""
android:orientation="vertical" >

    android:layout_height="240dp" />


Maybe it will help...

— modified on Jun 13, 2016 10:35:33 PM

  • Forum posts: 207

Jun 16, 2016 2:50:17 PM via Website

check your swip is working or not. may be there are some exceptions. Share