I\'ve already implemented this listener in order for me to display something when a certain date is clicked, but the problem is that when i scroll the CalendarView down, it
Finally I decided I needed to display an "OK" button below the CalendarView so the date can be chosen and the calendar dismissed.
Because when you click the current date nothing happens, and when you scroll you get calls to your OnDateChangeListener.
Example of calendar layout with black mask background you can click to dismiss:
Then sample code:
private void openCalendar(Date date) {
calendar.setDate(date.getTime());
calendarLayout.setVisibility(View.VISIBLE);
}
public void selectDate(View view) {
Date date = new Date(calendar.getDate());
// do whatever you need with date
dismissCalendar(view);
}
public void dismissCalendar(View view) {
calendarLayout.setVisibility(View.INVISIBLE);
}